home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / mapidefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  101.5 KB  |  2,674 lines

  1. /*
  2.  *  M A P I D E F S . H
  3.  *
  4.  *  Definitions used by MAPI clients and service providers.
  5.  *
  6.  *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  7.  */
  8.  
  9. #ifndef MAPIDEFS_H
  10. #define MAPIDEFS_H
  11. #pragma option push -b
  12.  
  13.  
  14. #ifdef __BORLANDC__
  15. #  include <pshpack8.h>
  16. #endif
  17.  
  18. #if defined (WIN32) && !defined (_WIN32)
  19. #define _WIN32
  20. #endif
  21.  
  22. #if defined (_WIN32) /* Must include WINDOWS.H on Win32 */
  23. #ifndef _WINDOWS_
  24. #define INC_OLE2 /* Get the OLE2 stuff */
  25. #define INC_RPC  /* harmless on Windows NT; Windows 95 needs it */
  26. #define _INC_OLE /* Windows 95 will include OLE1 without this */
  27.  
  28. #include <windows.h>
  29.  
  30. #endif
  31.  
  32. #ifndef _OLEERROR_H_
  33.  
  34. #include <winerror.h>
  35.  
  36. #endif
  37. #ifndef _OBJBASE_H_
  38.  
  39. #include <objbase.h>
  40.  
  41. #endif
  42. #endif
  43.  
  44. #if defined (WIN16) || defined (DOS) || defined (DOS16)
  45. #ifndef _COMPOBJ_H_
  46.  
  47. #include <compobj.h>
  48.  
  49. #endif
  50. #endif
  51.  
  52. #ifndef _INC_STDDEF
  53.  
  54. #include <stddef.h>
  55.  
  56. #endif
  57.  
  58. /* Array dimension for structures with variable-sized arrays at the end. */
  59.  
  60. #ifndef MAPI_DIM
  61. #define MAPI_DIM    1
  62. #endif
  63.  
  64. /* Provider init type. Force to cdecl always */
  65.  
  66. #ifndef STDMAPIINITCALLTYPE
  67. #if !defined (_MAC) && defined (_WIN32)
  68. #define STDMAPIINITCALLTYPE     __cdecl
  69. #else
  70. #define STDMAPIINITCALLTYPE     STDMETHODCALLTYPE
  71. #endif
  72. #define STDINITMETHODIMP        HRESULT STDMAPIINITCALLTYPE
  73. #define STDINITMETHODIMP_(type) type STDMAPIINITCALLTYPE
  74. #endif
  75.  
  76.  
  77. #define MAPI_NT_SERVICE     0x00010000  /* Provider is being loaded in an NT service */
  78.  
  79.  
  80. #ifdef  __cplusplus
  81. extern "C" {
  82. #endif
  83.  
  84. /* Simple data types */
  85.  
  86. #if !defined (MIDL_PASS) /* MIDL doesn't want to see these */
  87.  
  88. #if defined (__BORLANDC__) && defined (__cplusplus)
  89. typedef wchar_t             WCHAR;
  90. #else
  91. typedef WORD                WCHAR;
  92. #endif
  93.  
  94. #ifdef UNICODE
  95. typedef WCHAR               TCHAR;
  96. #else
  97. typedef char                TCHAR;
  98. #endif
  99.  
  100. typedef WCHAR FAR *         LPWSTR;
  101. typedef const WCHAR FAR *   LPCWSTR;
  102. typedef TCHAR FAR *         LPTSTR;
  103. typedef const TCHAR FAR *   LPCTSTR;
  104. typedef BYTE FAR *          LPBYTE;
  105. #endif /* defined MIDL_PASS */
  106.  
  107. typedef ULONG FAR *         LPULONG;
  108.  
  109. #ifndef __LHANDLE
  110. #define __LHANDLE
  111. typedef unsigned long   LHANDLE, FAR * LPLHANDLE;
  112. #endif
  113.  
  114. #if !defined(_WINBASE_) && !defined(_FILETIME_)
  115. #define _FILETIME_
  116. typedef struct _FILETIME
  117. {
  118.     DWORD dwLowDateTime;
  119.     DWORD dwHighDateTime;
  120. } FILETIME, FAR * LPFILETIME;
  121. #endif
  122.  
  123. #ifndef BEGIN_INTERFACE
  124. #define BEGIN_INTERFACE
  125. #endif
  126.  
  127. /*
  128.  *  This flag is used in many different MAPI calls to signify that
  129.  *  the object opened by the call should be modifiable (MAPI_MODIFY).
  130.  *  If the flag MAPI_MAX_ACCESS is set, the object returned should be
  131.  *  returned at the maximum access level allowed.  An additional
  132.  *  property available on the object (PR_ACCESS_LEVEL) uses the same
  133.  *  MAPI_MODIFY flag to say just what this new access level is.
  134.  */
  135.  
  136. #define MAPI_MODIFY             ((ULONG) 0x00000001)
  137.  
  138. /*
  139.  *  The following flags are used to indicate to the client what access
  140.  *  level is permissible in the object. They appear in PR_ACCESS in
  141.  *  message and folder objects as well as in contents and associated
  142.  *  contents tables
  143.  */
  144.  
  145. #define MAPI_ACCESS_MODIFY                  ((ULONG) 0x00000001)
  146. #define MAPI_ACCESS_READ                    ((ULONG) 0x00000002)
  147. #define MAPI_ACCESS_DELETE                  ((ULONG) 0x00000004)
  148. #define MAPI_ACCESS_CREATE_HIERARCHY        ((ULONG) 0x00000008)
  149. #define MAPI_ACCESS_CREATE_CONTENTS         ((ULONG) 0x00000010)
  150. #define MAPI_ACCESS_CREATE_ASSOCIATED       ((ULONG) 0x00000020)
  151.  
  152. /*
  153.  *  The MAPI_UNICODE flag is used in many different MAPI calls to signify
  154.  *  that strings passed through the interface are in Unicode (a 16-bit
  155.  *  character set). The default is an 8-bit character set.
  156.  *
  157.  *  The value fMapiUnicode can be used as the 'normal' value for
  158.  *  that bit, given the application's default character set.
  159.  */
  160.  
  161. #define MAPI_UNICODE            ((ULONG) 0x80000000)
  162.  
  163. #ifdef UNICODE
  164. #define fMapiUnicode            MAPI_UNICODE
  165. #else
  166. #define fMapiUnicode            0
  167. #endif
  168.  
  169. /* successful HRESULT */
  170. #define hrSuccess               0
  171.  
  172.  
  173.  
  174. /* Recipient types */
  175. #ifndef MAPI_ORIG               /* also defined in mapi.h */
  176. #define MAPI_ORIG   0           /* Recipient is message originator          */
  177. #define MAPI_TO     1           /* Recipient is a primary recipient         */
  178. #define MAPI_CC     2           /* Recipient is a copy recipient            */
  179. #define MAPI_BCC    3           /* Recipient is blind copy recipient        */
  180. #define MAPI_P1     0x10000000  /* Recipient is a P1 resend recipient       */
  181. #define MAPI_SUBMITTED 0x80000000 /* Recipient is already processed         */
  182. /* #define MAPI_AUTHORIZE 4        recipient is a CMC authorizing user      */
  183. /*#define MAPI_DISCRETE 0x10000000 Recipient is a P1 resend recipient       */
  184. #endif
  185.  
  186. /* Bit definitions for abFlags[0] of ENTRYID */
  187. #define MAPI_SHORTTERM          0x80
  188. #define MAPI_NOTRECIP           0x40
  189. #define MAPI_THISSESSION        0x20
  190. #define MAPI_NOW                0x10
  191. #define MAPI_NOTRESERVED        0x08
  192.  
  193. /* Bit definitions for abFlags[1] of ENTRYID */
  194. #define MAPI_COMPOUND           0x80
  195.  
  196. /* ENTRYID */
  197. typedef struct
  198. {
  199.     BYTE    abFlags[4];
  200.     BYTE    ab[MAPI_DIM];
  201. } ENTRYID, FAR *LPENTRYID;
  202.  
  203. #define CbNewENTRYID(_cb)       (offsetof(ENTRYID,ab) + (_cb))
  204. #define CbENTRYID(_cb)          (offsetof(ENTRYID,ab) + (_cb))
  205. #define SizedENTRYID(_cb, _name) \
  206.     struct _ENTRYID_ ## _name \
  207. { \
  208.     BYTE    abFlags[4]; \
  209.     BYTE    ab[_cb]; \
  210. } _name
  211.  
  212. /* Byte-order-independent version of GUID (world-unique identifier) */
  213. typedef struct _MAPIUID
  214. {
  215.     BYTE ab[16];
  216. } MAPIUID, FAR * LPMAPIUID;
  217.  
  218. /* Note:  need to include C run-times (memory.h) to use this macro */
  219.  
  220. #define IsEqualMAPIUID(lpuid1, lpuid2)  (!memcmp(lpuid1, lpuid2, sizeof(MAPIUID)))
  221.  
  222. /*
  223.  * Constants for one-off entry ID:
  224.  * The MAPIUID that identifies the one-off provider;
  225.  * the flag that defines whether the embedded strings are Unicode;
  226.  * the flag that specifies whether the recipient gets TNEF or not.
  227.  */
  228.  
  229. #define MAPI_ONE_OFF_UID { 0x81, 0x2b, 0x1f, 0xa4, 0xbe, 0xa3, 0x10, 0x19, \
  230.                            0x9d, 0x6e, 0x00, 0xdd, 0x01, 0x0f, 0x54, 0x02 }
  231. #define MAPI_ONE_OFF_UNICODE        0x8000
  232. #define MAPI_ONE_OFF_NO_RICH_INFO   0x0001
  233.  
  234. /* Object type */
  235.  
  236. #define MAPI_STORE      ((ULONG) 0x00000001)    /* Message Store */
  237. #define MAPI_ADDRBOOK   ((ULONG) 0x00000002)    /* Address Book */
  238. #define MAPI_FOLDER     ((ULONG) 0x00000003)    /* Folder */
  239. #define MAPI_ABCONT     ((ULONG) 0x00000004)    /* Address Book Container */
  240. #define MAPI_MESSAGE    ((ULONG) 0x00000005)    /* Message */
  241. #define MAPI_MAILUSER   ((ULONG) 0x00000006)    /* Individual Recipient */
  242. #define MAPI_ATTACH     ((ULONG) 0x00000007)    /* Attachment */
  243. #define MAPI_DISTLIST   ((ULONG) 0x00000008)    /* Distribution List Recipient */
  244. #define MAPI_PROFSECT   ((ULONG) 0x00000009)    /* Profile Section */
  245. #define MAPI_STATUS     ((ULONG) 0x0000000A)    /* Status Object */
  246. #define MAPI_SESSION    ((ULONG) 0x0000000B)    /* Session */
  247. #define MAPI_FORMINFO   ((ULONG) 0x0000000C)    /* Form Information */
  248.  
  249.  
  250. /*
  251.  *  Maximum length of profile names and passwords, not including
  252.  *  the null termination character.
  253.  */
  254. #ifndef cchProfileNameMax
  255. #define cchProfileNameMax   64
  256. #define cchProfilePassMax   64
  257. #endif
  258.  
  259.  
  260. /* Property Types */
  261.  
  262. #define MV_FLAG         0x1000          /* Multi-value flag */
  263.  
  264. #define PT_UNSPECIFIED  ((ULONG)  0)    /* (Reserved for interface use) type doesn't matter to caller */
  265. #define PT_NULL         ((ULONG)  1)    /* NULL property value */
  266. #define PT_I2           ((ULONG)  2)    /* Signed 16-bit value */
  267. #define PT_LONG         ((ULONG)  3)    /* Signed 32-bit value */
  268. #define PT_R4           ((ULONG)  4)    /* 4-byte floating point */
  269. #define PT_DOUBLE       ((ULONG)  5)    /* Floating point double */
  270. #define PT_CURRENCY     ((ULONG)  6)    /* Signed 64-bit int (decimal w/    4 digits right of decimal pt) */
  271. #define PT_APPTIME      ((ULONG)  7)    /* Application time */
  272. #define PT_ERROR        ((ULONG) 10)    /* 32-bit error value */
  273. #define PT_BOOLEAN      ((ULONG) 11)    /* 16-bit boolean (non-zero true) */
  274. #define PT_OBJECT       ((ULONG) 13)    /* Embedded object in a property */
  275. #define PT_I8           ((ULONG) 20)    /* 8-byte signed integer */
  276. #define PT_STRING8      ((ULONG) 30)    /* Null terminated 8-bit character string */
  277. #define PT_UNICODE      ((ULONG) 31)    /* Null terminated Unicode string */
  278. #define PT_SYSTIME      ((ULONG) 64)    /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
  279. #define PT_CLSID        ((ULONG) 72)    /* OLE GUID */
  280. #define PT_BINARY       ((ULONG) 258)   /* Uninterpreted (counted byte array) */
  281. /* Changes are likely to these numbers, and to their structures. */
  282.  
  283. /* Alternate property type names for ease of use */
  284. #define PT_SHORT    PT_I2
  285. #define PT_I4       PT_LONG
  286. #define PT_FLOAT    PT_R4
  287. #define PT_R8       PT_DOUBLE
  288. #define PT_LONGLONG PT_I8
  289.  
  290. /*
  291.  *  The type of a MAPI-defined string property is indirected, so
  292.  *  that it defaults to Unicode string on a Unicode platform and to
  293.  *  String8 on an ANSI or DBCS platform.
  294.  *
  295.  *  Macros are defined here both for the property type, and for the
  296.  *  field of the property value structure which should be
  297.  *  dereferenced to obtain the string pointer.
  298.  */
  299.  
  300. #ifdef  UNICODE
  301. #define PT_TSTRING          PT_UNICODE
  302. #define PT_MV_TSTRING       (MV_FLAG|PT_UNICODE)
  303. #define LPSZ                lpszW
  304. #define LPPSZ               lppszW
  305. #define MVSZ                MVszW
  306. #else
  307. #define PT_TSTRING          PT_STRING8
  308. #define PT_MV_TSTRING       (MV_FLAG|PT_STRING8)
  309. #define LPSZ                lpszA
  310. #define LPPSZ               lppszA
  311. #define MVSZ                MVszA
  312. #endif
  313.  
  314.  
  315. /* Property Tags
  316.  *
  317.  * By convention, MAPI never uses 0 or FFFF as a property ID.
  318.  * Use as null values, initializers, sentinels, or what have you.
  319.  */
  320.  
  321. #define PROP_TYPE_MASK          ((ULONG)0x0000FFFF) /* Mask for Property type */
  322. #define PROP_TYPE(ulPropTag)    (((ULONG)(ulPropTag))&PROP_TYPE_MASK)
  323. #define PROP_ID(ulPropTag)      (((ULONG)(ulPropTag))>>16)
  324. #define PROP_TAG(ulPropType,ulPropID)   ((((ULONG)(ulPropID))<<16)|((ULONG)(ulPropType)))
  325. #define PROP_ID_NULL            0
  326. #define PROP_ID_INVALID         0xFFFF
  327. #define PR_NULL                 PROP_TAG( PT_NULL, PROP_ID_NULL)
  328. #define CHANGE_PROP_TYPE(ulPropTag, ulPropType) \
  329.                         (((ULONG)0xFFFF0000 & ulPropTag) | ulPropType)
  330.  
  331.  
  332. /* Multi-valued Property Types */
  333.  
  334. #define PT_MV_I2        (MV_FLAG|PT_I2)
  335. #define PT_MV_LONG      (MV_FLAG|PT_LONG)
  336. #define PT_MV_R4        (MV_FLAG|PT_R4)
  337. #define PT_MV_DOUBLE    (MV_FLAG|PT_DOUBLE)
  338. #define PT_MV_CURRENCY  (MV_FLAG|PT_CURRENCY)
  339. #define PT_MV_APPTIME   (MV_FLAG|PT_APPTIME)
  340. #define PT_MV_SYSTIME   (MV_FLAG|PT_SYSTIME)
  341. #define PT_MV_STRING8   (MV_FLAG|PT_STRING8)
  342. #define PT_MV_BINARY    (MV_FLAG|PT_BINARY)
  343. #define PT_MV_UNICODE   (MV_FLAG|PT_UNICODE)
  344. #define PT_MV_CLSID     (MV_FLAG|PT_CLSID)
  345. #define PT_MV_I8        (MV_FLAG|PT_I8)
  346.  
  347. /* Alternate property type names for ease of use */
  348. #define PT_MV_SHORT     PT_MV_I2
  349. #define PT_MV_I4        PT_MV_LONG
  350. #define PT_MV_FLOAT     PT_MV_R4
  351. #define PT_MV_R8        PT_MV_DOUBLE
  352. #define PT_MV_LONGLONG  PT_MV_I8
  353.  
  354. /*
  355.  *  Property type reserved bits
  356.  *
  357.  *  MV_INSTANCE is used as a flag in table operations to request
  358.  *  that a multi-valued property be presented as a single-valued
  359.  *  property appearing in multiple rows.
  360.  */
  361.  
  362. #define MV_INSTANCE     0x2000
  363. #define MVI_FLAG        (MV_FLAG | MV_INSTANCE)
  364. #define MVI_PROP(tag)   ((tag) | MVI_FLAG)
  365.  
  366. /* --------------- */
  367. /* Data Structures */
  368. /* --------------- */
  369.  
  370. /* Property Tag Array */
  371.  
  372. typedef struct _SPropTagArray
  373. {
  374.     ULONG   cValues;
  375.     ULONG   aulPropTag[MAPI_DIM];
  376. } SPropTagArray, FAR * LPSPropTagArray;
  377.  
  378. #define CbNewSPropTagArray(_ctag) \
  379.     (offsetof(SPropTagArray,aulPropTag) + (_ctag)*sizeof(ULONG))
  380. #define CbSPropTagArray(_lparray) \
  381.     (offsetof(SPropTagArray,aulPropTag) + \
  382.     (UINT)((_lparray)->cValues)*sizeof(ULONG))
  383. /*  SPropTagArray */
  384. #define SizedSPropTagArray(_ctag, _name) \
  385. struct _SPropTagArray_ ## _name \
  386. { \
  387.     ULONG   cValues; \
  388.     ULONG   aulPropTag[_ctag]; \
  389. } _name
  390.  
  391. /* -------------- */
  392. /* Property Value */
  393. /* -------------- */
  394.  
  395. typedef struct _SPropValue  SPropValue;
  396.  
  397.  
  398. /* 32-bit CURRENCY definition stolen from oaidl.h */
  399. /* 16-bit CURRENCY definition stolen from variant.h */
  400.  
  401. #ifndef _tagCY_DEFINED
  402. #define _tagCY_DEFINED
  403. #define _CY_DEFINED
  404. #if (defined (WIN16) || defined (DOS)) && !defined (_VARIANT_H_)
  405. typedef struct FARSTRUCT tagCY {
  406. #ifdef _MAC
  407.         long      Hi;
  408.         long Lo;
  409. #else
  410.         unsigned long Lo;
  411.         long      Hi;
  412. #endif
  413. } CY;
  414. #elif defined (_WIN32)
  415. /* real definition that makes the C++ compiler happy */
  416. typedef union tagCY {
  417.     struct {
  418. #ifdef _MAC
  419.         long      Hi;
  420.         long Lo;
  421. #else
  422.         unsigned long Lo;
  423.         long      Hi;
  424. #endif
  425.     };
  426.     LONGLONG int64;
  427. } CY;
  428. #endif /* 16-bit vs 32-bit definition */
  429. #endif
  430.             /* size is 8 */
  431. typedef CY CURRENCY;
  432.  
  433. typedef struct _SBinary
  434. {
  435.     ULONG       cb;
  436.     LPBYTE      lpb;
  437. } SBinary, FAR *LPSBinary;
  438.  
  439. typedef struct _SShortArray
  440. {
  441.     ULONG       cValues;
  442.     short int   FAR *lpi;
  443. } SShortArray;
  444.  
  445. typedef struct _SGuidArray
  446. {
  447.     ULONG       cValues;
  448.     GUID        FAR *lpguid;
  449. } SGuidArray;
  450.  
  451. typedef struct _SRealArray
  452. {
  453.     ULONG       cValues;
  454.     float       FAR *lpflt;
  455. } SRealArray;
  456.  
  457. typedef struct _SLongArray
  458. {
  459.     ULONG       cValues;
  460.     LONG        FAR *lpl;
  461. } SLongArray;
  462.  
  463. typedef struct _SLargeIntegerArray
  464. {
  465.     ULONG       cValues;
  466.     LARGE_INTEGER   FAR *lpli;
  467. } SLargeIntegerArray;
  468.  
  469. typedef struct _SDateTimeArray
  470. {
  471.     ULONG       cValues;
  472.     FILETIME    FAR *lpft;
  473. } SDateTimeArray;
  474.  
  475. typedef struct _SAppTimeArray
  476. {
  477.     ULONG       cValues;
  478.     double      FAR *lpat;
  479. } SAppTimeArray;
  480.  
  481. typedef struct _SCurrencyArray
  482. {
  483.     ULONG       cValues;
  484.     CURRENCY    FAR *lpcur;
  485. } SCurrencyArray;
  486.  
  487. typedef struct _SBinaryArray
  488. {
  489.     ULONG       cValues;
  490.     SBinary     FAR *lpbin;
  491. } SBinaryArray;
  492.  
  493. typedef struct _SDoubleArray
  494. {
  495.     ULONG       cValues;
  496.     double      FAR *lpdbl;
  497. } SDoubleArray;
  498.  
  499. typedef struct _SWStringArray
  500. {
  501.     ULONG       cValues;
  502.     LPWSTR      FAR *lppszW;
  503. } SWStringArray;
  504.  
  505. typedef struct _SLPSTRArray
  506. {
  507.     ULONG       cValues;
  508.     LPSTR       FAR *lppszA;
  509. } SLPSTRArray;
  510.  
  511. typedef union _PV
  512. {
  513.     short int           i;          /* case PT_I2 */
  514.     LONG                l;          /* case PT_LONG */
  515.     ULONG               ul;         /* alias for PT_LONG */
  516.     float               flt;        /* case PT_R4 */
  517.     double              dbl;        /* case PT_DOUBLE */
  518.     unsigned short int  b;          /* case PT_BOOLEAN */
  519.     CURRENCY            cur;        /* case PT_CURRENCY */
  520.     double              at;         /* case PT_APPTIME */
  521.     FILETIME            ft;         /* case PT_SYSTIME */
  522.     LPSTR               lpszA;      /* case PT_STRING8 */
  523.     SBinary             bin;        /* case PT_BINARY */
  524.     LPWSTR              lpszW;      /* case PT_UNICODE */
  525.     LPGUID              lpguid;     /* case PT_CLSID */
  526.     LARGE_INTEGER       li;         /* case PT_I8 */
  527.     SShortArray         MVi;        /* case PT_MV_I2 */
  528.     SLongArray          MVl;        /* case PT_MV_LONG */
  529.     SRealArray          MVflt;      /* case PT_MV_R4 */
  530.     SDoubleArray        MVdbl;      /* case PT_MV_DOUBLE */
  531.     SCurrencyArray      MVcur;      /* case PT_MV_CURRENCY */
  532.     SAppTimeArray       MVat;       /* case PT_MV_APPTIME */
  533.     SDateTimeArray      MVft;       /* case PT_MV_SYSTIME */
  534.     SBinaryArray        MVbin;      /* case PT_MV_BINARY */
  535.     SLPSTRArray         MVszA;      /* case PT_MV_STRING8 */
  536.     SWStringArray       MVszW;      /* case PT_MV_UNICODE */
  537.     SGuidArray          MVguid;     /* case PT_MV_CLSID */
  538.     SLargeIntegerArray  MVli;       /* case PT_MV_I8 */
  539.     SCODE               err;        /* case PT_ERROR */
  540.     LONG                x;          /* case PT_NULL, PT_OBJECT (no usable value) */
  541. } __UPV;
  542.  
  543. typedef struct _SPropValue
  544. {
  545.     ULONG       ulPropTag;
  546.     ULONG       dwAlignPad;
  547.     union _PV   Value;
  548. } SPropValue, FAR * LPSPropValue;
  549.  
  550.  
  551. /* --------------------------------------------- */
  552. /* Property Problem and Property Problem Arrays */
  553. /* --------------------------------------------- */
  554.  
  555. typedef struct _SPropProblem
  556. {
  557.     ULONG   ulIndex;
  558.     ULONG   ulPropTag;
  559.     SCODE   scode;
  560. } SPropProblem, FAR * LPSPropProblem;
  561.  
  562. typedef struct _SPropProblemArray
  563. {
  564.     ULONG           cProblem;
  565.     SPropProblem    aProblem[MAPI_DIM];
  566. } SPropProblemArray, FAR * LPSPropProblemArray;
  567.  
  568. #define CbNewSPropProblemArray(_cprob) \
  569.     (offsetof(SPropProblemArray,aProblem) + (_cprob)*sizeof(SPropProblem))
  570. #define CbSPropProblemArray(_lparray) \
  571.     (offsetof(SPropProblemArray,aProblem) + \
  572.     (UINT) ((_lparray)->cProblem*sizeof(SPropProblem)))
  573. #define SizedSPropProblemArray(_cprob, _name) \
  574. struct _SPropProblemArray_ ## _name \
  575. { \
  576.     ULONG           cProblem; \
  577.     SPropProblem    aProblem[_cprob]; \
  578. } _name
  579.  
  580. /*
  581.  *  ENTRYLIST
  582.  */
  583.  
  584. typedef SBinaryArray ENTRYLIST, FAR *LPENTRYLIST;
  585.  
  586. /*
  587.  *  FLATENTRYLIST
  588.  *  MTSID
  589.  *  FLATMTSIDLIST
  590.  */
  591.  
  592. typedef struct {
  593.     ULONG cb;
  594.     BYTE abEntry[MAPI_DIM];
  595. } FLATENTRY, FAR *LPFLATENTRY;
  596.  
  597. typedef struct {
  598.     ULONG       cEntries;
  599.     ULONG       cbEntries;
  600.     BYTE        abEntries[MAPI_DIM];
  601. } FLATENTRYLIST, FAR *LPFLATENTRYLIST;
  602.  
  603. typedef struct {
  604.     ULONG       cb;
  605.     BYTE        ab[MAPI_DIM];
  606. } MTSID, FAR *LPMTSID;
  607.  
  608. typedef struct {
  609.     ULONG       cMTSIDs;
  610.     ULONG       cbMTSIDs;
  611.     BYTE        abMTSIDs[MAPI_DIM];
  612. } FLATMTSIDLIST, FAR *LPFLATMTSIDLIST;
  613.  
  614. #define CbNewFLATENTRY(_cb)     (offsetof(FLATENTRY,abEntry) + (_cb))
  615. #define CbFLATENTRY(_lpentry)   (offsetof(FLATENTRY,abEntry) + (_lpentry)->cb)
  616. #define CbNewFLATENTRYLIST(_cb) (offsetof(FLATENTRYLIST,abEntries) + (_cb))
  617. #define CbFLATENTRYLIST(_lplist) (offsetof(FLATENTRYLIST,abEntries) + (_lplist)->cbEntries)
  618. #define CbNewMTSID(_cb)         (offsetof(MTSID,ab) + (_cb))
  619. #define CbMTSID(_lpentry)       (offsetof(MTSID,ab) + (_lpentry)->cb)
  620. #define CbNewFLATMTSIDLIST(_cb) (offsetof(FLATMTSIDLIST,abMTSIDs) + (_cb))
  621. #define CbFLATMTSIDLIST(_lplist) (offsetof(FLATMTSIDLIST,abMTSIDs) + (_lplist)->cbMTSIDs)
  622. /* No SizedXXX macros for these types. */
  623.  
  624. /* ------------------------------ */
  625. /* ADRENTRY, ADRLIST */
  626.  
  627. typedef struct _ADRENTRY
  628. {
  629.     ULONG           ulReserved1;    /* Never used */
  630.     ULONG           cValues;
  631.     LPSPropValue    rgPropVals;
  632. } ADRENTRY, FAR * LPADRENTRY;
  633.  
  634. typedef struct _ADRLIST
  635. {
  636.     ULONG           cEntries;
  637.     ADRENTRY        aEntries[MAPI_DIM];
  638. } ADRLIST, FAR * LPADRLIST;
  639.  
  640. #define CbNewADRLIST(_centries) \
  641.     (offsetof(ADRLIST,aEntries) + (_centries)*sizeof(ADRENTRY))
  642. #define CbADRLIST(_lpadrlist) \
  643.     (offsetof(ADRLIST,aEntries) + (UINT)(_lpadrlist)->cEntries*sizeof(ADRENTRY))
  644. #define SizedADRLIST(_centries, _name) \
  645. struct _ADRLIST_ ## _name \
  646. { \
  647.     ULONG           cEntries; \
  648.     ADRENTRY        aEntries[_centries]; \
  649. } _name
  650.  
  651. /* ------------------------------ */
  652. /* SRow, SRowSet */
  653.  
  654. typedef struct _SRow
  655. {
  656.     ULONG           ulAdrEntryPad;  /* Pad so SRow's can map to ADRENTRY's */
  657.     ULONG           cValues;        /* Count of property values */
  658.     LPSPropValue    lpProps;        /* Property value array */
  659. } SRow, FAR * LPSRow;
  660.  
  661. typedef struct _SRowSet
  662. {
  663.     ULONG           cRows;          /* Count of rows */
  664.     SRow            aRow[MAPI_DIM]; /* Array of rows */
  665. } SRowSet, FAR * LPSRowSet;
  666.  
  667. #define CbNewSRowSet(_crow)     (offsetof(SRowSet,aRow) + (_crow)*sizeof(SRow))
  668. #define CbSRowSet(_lprowset)    (offsetof(SRowSet,aRow) + \
  669.                                     (UINT)((_lprowset)->cRows*sizeof(SRow)))
  670. #define SizedSRowSet(_crow, _name) \
  671. struct _SRowSet_ ## _name \
  672. { \
  673.     ULONG           cRows; \
  674.     SRow            aRow[_crow]; \
  675. } _name
  676.  
  677. /* MAPI Allocation Routines ------------------------------------------------ */
  678.  
  679. typedef SCODE (STDMETHODCALLTYPE ALLOCATEBUFFER)(
  680.     ULONG           cbSize,
  681.     LPVOID FAR *    lppBuffer
  682. );
  683.  
  684. typedef SCODE (STDMETHODCALLTYPE ALLOCATEMORE)(
  685.     ULONG           cbSize,
  686.     LPVOID          lpObject,
  687.     LPVOID FAR *    lppBuffer
  688. );
  689.  
  690. typedef ULONG (STDAPICALLTYPE FREEBUFFER)(
  691.     LPVOID          lpBuffer
  692. );
  693.  
  694. typedef ALLOCATEBUFFER FAR *LPALLOCATEBUFFER;
  695. typedef ALLOCATEMORE FAR *  LPALLOCATEMORE;
  696. typedef FREEBUFFER FAR *    LPFREEBUFFER;
  697.  
  698. /* MAPI Component Object Model Macros -------------------------------------- */
  699.  
  700. #if defined(MAPI_IF) && (!defined(__cplusplus) || defined(CINTERFACE))
  701. #define DECLARE_MAPI_INTERFACE(iface)                                   \
  702.         typedef struct iface##Vtbl iface##Vtbl, FAR * iface;            \
  703.         struct iface##Vtbl
  704. #define DECLARE_MAPI_INTERFACE_(iface, baseiface)                       \
  705.         DECLARE_MAPI_INTERFACE(iface)
  706. #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
  707.         typedef struct iface##Vtbl iface##Vtbl, FAR * iface, FAR * FAR * piface;
  708. #else
  709. #define DECLARE_MAPI_INTERFACE(iface)                                   \
  710.         DECLARE_INTERFACE(iface)
  711. #define DECLARE_MAPI_INTERFACE_(iface, baseiface)                       \
  712.         DECLARE_INTERFACE_(iface, baseiface)
  713. #ifdef __cplusplus
  714. #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
  715.         interface iface; typedef iface FAR * piface
  716. #else
  717. #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
  718.         typedef interface iface iface, FAR * piface
  719. #endif
  720. #endif
  721.  
  722. #define MAPIMETHOD(method)              MAPIMETHOD_(HRESULT, method)
  723. #define MAPIMETHOD_(type, method)       STDMETHOD_(type, method)
  724. #define MAPIMETHOD_DECLARE(type, method, prefix) \
  725.         STDMETHODIMP_(type) prefix##method
  726. #define MAPIMETHOD_TYPEDEF(type, method, prefix) \
  727.         typedef type (STDMETHODCALLTYPE prefix##method##_METHOD)
  728.  
  729. #define MAPI_IUNKNOWN_METHODS(IPURE)                                    \
  730.     MAPIMETHOD(QueryInterface)                                          \
  731.         (THIS_ REFIID riid, LPVOID FAR * ppvObj) IPURE;                 \
  732.     MAPIMETHOD_(ULONG,AddRef)  (THIS) IPURE;                            \
  733.     MAPIMETHOD_(ULONG,Release) (THIS) IPURE;                            \
  734.  
  735. #undef  IMPL
  736. #define IMPL
  737.  
  738. /* Pointers to MAPI Interfaces --------------------------------------------- */
  739.  
  740. typedef const IID FAR * LPCIID;
  741.  
  742. DECLARE_MAPI_INTERFACE_PTR(IMsgStore,       LPMDB);
  743. DECLARE_MAPI_INTERFACE_PTR(IMAPIFolder,     LPMAPIFOLDER);
  744. DECLARE_MAPI_INTERFACE_PTR(IMessage,        LPMESSAGE);
  745. DECLARE_MAPI_INTERFACE_PTR(IAttach,         LPATTACH);
  746. DECLARE_MAPI_INTERFACE_PTR(IAddrBook,       LPADRBOOK);
  747. DECLARE_MAPI_INTERFACE_PTR(IABContainer,    LPABCONT);
  748. DECLARE_MAPI_INTERFACE_PTR(IMailUser,       LPMAILUSER);
  749. DECLARE_MAPI_INTERFACE_PTR(IDistList,       LPDISTLIST);
  750. DECLARE_MAPI_INTERFACE_PTR(IMAPIStatus,     LPMAPISTATUS);
  751. DECLARE_MAPI_INTERFACE_PTR(IMAPITable,      LPMAPITABLE);
  752. DECLARE_MAPI_INTERFACE_PTR(IProfSect,       LPPROFSECT);
  753. DECLARE_MAPI_INTERFACE_PTR(IMAPIProp,       LPMAPIPROP);
  754. DECLARE_MAPI_INTERFACE_PTR(IMAPIContainer,  LPMAPICONTAINER);
  755. DECLARE_MAPI_INTERFACE_PTR(IMAPIAdviseSink, LPMAPIADVISESINK);
  756. DECLARE_MAPI_INTERFACE_PTR(IMAPIProgress,   LPMAPIPROGRESS);
  757. DECLARE_MAPI_INTERFACE_PTR(IProviderAdmin,  LPPROVIDERADMIN);
  758.  
  759. /* Extended MAPI Error Information ----------------------------------------- */
  760.  
  761. typedef struct _MAPIERROR
  762. {
  763.     ULONG   ulVersion;
  764.     LPTSTR  lpszError;
  765.     LPTSTR  lpszComponent;
  766.     ULONG   ulLowLevelError;
  767.     ULONG   ulContext;
  768.  
  769. } MAPIERROR, FAR * LPMAPIERROR;
  770.  
  771.  
  772. /* IMAPIAdviseSink Interface ----------------------------------------------- */
  773.  
  774. /*
  775.  *  Notification event types. The event types can be combined in a bitmask
  776.  *  for filtering. Each one has a parameter structure associated with it:
  777.  *
  778.  *      fnevCriticalError       ERROR_NOTIFICATION
  779.  *      fnevNewMail             NEWMAIL_NOTIFICATION
  780.  *      fnevObjectCreated       OBJECT_NOTIFICATION
  781.  *      fnevObjectDeleted       OBJECT_NOTIFICATION
  782.  *      fnevObjectModified      OBJECT_NOTIFICATION
  783.  *      fnevObjectCopied        OBJECT_NOTIFICATION
  784.  *      fnevSearchComplete      OBJECT_NOTIFICATION
  785.  *      fnevTableModified       TABLE_NOTIFICATION
  786.  *      fnevStatusObjectModified ?
  787.  *
  788.  *      fnevExtended            EXTENDED_NOTIFICATION
  789.  */
  790.  
  791. #define fnevCriticalError           ((ULONG) 0x00000001)
  792. #define fnevNewMail                 ((ULONG) 0x00000002)
  793. #define fnevObjectCreated           ((ULONG) 0x00000004)
  794. #define fnevObjectDeleted           ((ULONG) 0x00000008)
  795. #define fnevObjectModified          ((ULONG) 0x00000010)
  796. #define fnevObjectMoved             ((ULONG) 0x00000020)
  797. #define fnevObjectCopied            ((ULONG) 0x00000040)
  798. #define fnevSearchComplete          ((ULONG) 0x00000080)
  799. #define fnevTableModified           ((ULONG) 0x00000100)
  800. #define fnevStatusObjectModified    ((ULONG) 0x00000200)
  801. #define fnevReservedForMapi         ((ULONG) 0x40000000)
  802. #define fnevExtended                ((ULONG) 0x80000000)
  803.  
  804. /* TABLE_NOTIFICATION event types passed in ulTableEvent */
  805.  
  806. #define TABLE_CHANGED       1
  807. #define TABLE_ERROR         2
  808. #define TABLE_ROW_ADDED     3
  809. #define TABLE_ROW_DELETED   4
  810. #define TABLE_ROW_MODIFIED  5
  811. #define TABLE_SORT_DONE     6
  812. #define TABLE_RESTRICT_DONE 7
  813. #define TABLE_SETCOL_DONE   8
  814. #define TABLE_RELOAD        9
  815.  
  816. /* Event Structures */
  817.  
  818. typedef struct _ERROR_NOTIFICATION
  819. {
  820.     ULONG       cbEntryID;
  821.     LPENTRYID   lpEntryID;
  822.     SCODE       scode;
  823.     ULONG       ulFlags;            /* 0 or MAPI_UNICODE */
  824.     LPMAPIERROR lpMAPIError;        /* Detailed error information */
  825. } ERROR_NOTIFICATION;
  826.  
  827. typedef struct _NEWMAIL_NOTIFICATION
  828. {
  829.     ULONG       cbEntryID;
  830.     LPENTRYID   lpEntryID;          /* identifies the new message */
  831.     ULONG       cbParentID;
  832.     LPENTRYID   lpParentID;         /* identifies the folder it lives in */
  833.     ULONG       ulFlags;            /* 0 or MAPI_UNICODE */
  834.     LPTSTR      lpszMessageClass;   /* message class (UNICODE or string8) */
  835.     ULONG       ulMessageFlags;     /* copy of PR_MESSAGE_FLAGS */
  836. } NEWMAIL_NOTIFICATION;
  837.  
  838. typedef struct _OBJECT_NOTIFICATION
  839. {
  840.     ULONG               cbEntryID;
  841.     LPENTRYID           lpEntryID;      /* EntryID of object */
  842.     ULONG               ulObjType;      /* Type of object */
  843.     ULONG               cbParentID;
  844.     LPENTRYID           lpParentID;     /* EntryID of parent object */
  845.     ULONG               cbOldID;
  846.     LPENTRYID           lpOldID;        /* EntryID of old object */
  847.     ULONG               cbOldParentID;
  848.     LPENTRYID           lpOldParentID;  /* EntryID of old parent */
  849.     LPSPropTagArray     lpPropTagArray;
  850. } OBJECT_NOTIFICATION;
  851.  
  852. typedef struct _TABLE_NOTIFICATION
  853. {
  854.     ULONG               ulTableEvent;   /* Identifies WHICH table event */
  855.     HRESULT             hResult;        /* Value for TABLE_ERROR */
  856.     SPropValue          propIndex;      /* This row's "index property" */
  857.     SPropValue          propPrior;      /* Preceding row's "index property" */
  858.     SRow                row;            /* New data of added/modified row */
  859.     ULONG               ulPad;          /* Force to 8-byte boundary */
  860. } TABLE_NOTIFICATION;
  861.  
  862. typedef struct _EXTENDED_NOTIFICATION
  863. {
  864.     ULONG       ulEvent;                    /* extended event code */
  865.     ULONG       cb;                         /* size of event parameters */
  866.     LPBYTE      pbEventParameters;          /* event parameters */
  867. } EXTENDED_NOTIFICATION;
  868.  
  869. typedef struct
  870. {
  871.     ULONG           cbEntryID;
  872.     LPENTRYID       lpEntryID;
  873.     ULONG           cValues;
  874.     LPSPropValue    lpPropVals;
  875. } STATUS_OBJECT_NOTIFICATION;
  876.  
  877. typedef struct _NOTIFICATION
  878. {
  879.     ULONG   ulEventType;        /* notification type, i.e. fnevSomething */
  880.     ULONG   ulAlignPad;         /* Force to 8-byte boundary */
  881.     union
  882.     {
  883.         ERROR_NOTIFICATION          err;
  884.         NEWMAIL_NOTIFICATION        newmail;
  885.         OBJECT_NOTIFICATION         obj;
  886.         TABLE_NOTIFICATION          tab;
  887.         EXTENDED_NOTIFICATION       ext;
  888.         STATUS_OBJECT_NOTIFICATION  statobj;
  889.     } info;
  890. } NOTIFICATION, FAR * LPNOTIFICATION;
  891.  
  892.  
  893. /* Interface used for registering and issuing notification callbacks. */
  894.  
  895. #define MAPI_IMAPIADVISESINK_METHODS(IPURE)                             \
  896.     MAPIMETHOD_(ULONG, OnNotify)                                        \
  897.         (THIS_  ULONG                       cNotif,                     \
  898.                 LPNOTIFICATION              lpNotifications) IPURE;     \
  899.  
  900. #undef       INTERFACE
  901. #define      INTERFACE  IMAPIAdviseSink
  902. DECLARE_MAPI_INTERFACE_(IMAPIAdviseSink, IUnknown)
  903. {
  904.     BEGIN_INTERFACE
  905.     MAPI_IUNKNOWN_METHODS(PURE)
  906.     MAPI_IMAPIADVISESINK_METHODS(PURE)
  907. };
  908.  
  909. /* Callback function type for MAPIAllocAdviseSink */
  910.  
  911. typedef long (STDAPICALLTYPE NOTIFCALLBACK) (
  912.     LPVOID          lpvContext,
  913.     ULONG           cNotification,
  914.     LPNOTIFICATION  lpNotifications);
  915. typedef NOTIFCALLBACK FAR * LPNOTIFCALLBACK;
  916.  
  917. /*
  918.  *  Message name for the 16-bit MAPI notififcation engine.
  919.  *  This can be used in 16-bit applications to force processing
  920.  *  of notification callbacks.
  921.  */
  922.  
  923. #define szMAPINotificationMsg "MAPI Notify window message"
  924.  
  925.  
  926. /* IMAPIProgress Interface ------------------------------------------------- */
  927.  
  928. /* Flag values for the progress indicator */
  929.  
  930. #define MAPI_TOP_LEVEL      ((ULONG) 0x00000001)
  931.  
  932. #define MAPI_IMAPIPROGRESS_METHODS(IPURE)                               \
  933.     MAPIMETHOD(Progress)                                                \
  934.         (THIS_  ULONG                       ulValue,                    \
  935.                 ULONG                       ulCount,                    \
  936.                 ULONG                       ulTotal) IPURE;             \
  937.     MAPIMETHOD(GetFlags)                                                \
  938.         (THIS_  ULONG FAR *                 lpulFlags) IPURE;           \
  939.     MAPIMETHOD(GetMax)                                                  \
  940.         (THIS_  ULONG FAR *                 lpulMax) IPURE;             \
  941.     MAPIMETHOD(GetMin)                                                  \
  942.         (THIS_  ULONG FAR *                 lpulMin) IPURE;             \
  943.     MAPIMETHOD(SetLimits)                                               \
  944.         (THIS_  LPULONG                     lpulMin,                    \
  945.                 LPULONG                     lpulMax,                    \
  946.                 LPULONG                     lpulFlags) IPURE;           \
  947.  
  948. #undef      INTERFACE
  949. #define     INTERFACE   IMAPIProgress
  950. DECLARE_MAPI_INTERFACE_(IMAPIProgress, IUnknown)
  951. {
  952.     BEGIN_INTERFACE
  953.     MAPI_IUNKNOWN_METHODS(PURE)
  954.     MAPI_IMAPIPROGRESS_METHODS(PURE)
  955. };
  956.  
  957.  
  958. /* IMAPIProp Interface ----------------------------------------------------- */
  959.  
  960. /* GetLastError */
  961. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  962.  
  963. /*
  964.  *  Version:
  965.  */
  966. #define MAPI_ERROR_VERSION      0x00000000L
  967.  
  968. /* GetPropList */
  969. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  970.  
  971. /* GetProps */
  972. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  973.  
  974. /* SaveChanges */
  975.  
  976. #define KEEP_OPEN_READONLY      ((ULONG) 0x00000001)
  977. #define KEEP_OPEN_READWRITE     ((ULONG) 0x00000002)
  978. #define FORCE_SAVE              ((ULONG) 0x00000004)
  979. /* define MAPI_DEFERRED_ERRORS  ((ULONG) 0x00000008) below */
  980.  
  981. /* OpenProperty  - ulFlags */
  982. /****** MAPI_MODIFY             ((ULONG) 0x00000001) above */
  983. #define MAPI_CREATE             ((ULONG) 0x00000002)
  984. #define STREAM_APPEND           ((ULONG) 0x00000004)
  985. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  986.  
  987. /* OpenProperty  - ulInterfaceOptions, IID_IMAPITable */
  988. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  989.  
  990. /* CopyTo, CopyProps */
  991.  
  992. #define MAPI_MOVE               ((ULONG) 0x00000001)
  993. #define MAPI_NOREPLACE          ((ULONG) 0x00000002)
  994. #define MAPI_DECLINE_OK         ((ULONG) 0x00000004)
  995.  
  996. #ifndef MAPI_DIALOG             /* also defined in mapi.h */
  997. #define MAPI_DIALOG             ((ULONG) 0x00000008)
  998. #endif
  999.  
  1000. #ifndef MAPI_USE_DEFAULT        /* also defined in mapi.h */
  1001. #define MAPI_USE_DEFAULT        0x00000040  /* Use default profile in logon */
  1002. #endif
  1003.  
  1004. /* Flags used in GetIDsFromNames  */
  1005. /****** MAPI_CREATE             ((ULONG) 0x00000002) above */
  1006.  
  1007. /* Flags used in GetNamesFromIDs  (bit fields) */
  1008. #define MAPI_NO_STRINGS         ((ULONG) 0x00000001)
  1009. #define MAPI_NO_IDS             ((ULONG) 0x00000002)
  1010.  
  1011. /*  Union discriminator  */
  1012. #define MNID_ID                 0
  1013. #define MNID_STRING             1
  1014. typedef struct _MAPINAMEID
  1015. {
  1016.     LPGUID lpguid;
  1017.     ULONG ulKind;
  1018.     union {
  1019.         LONG lID;
  1020.         LPWSTR lpwstrName;
  1021.     } Kind;
  1022.  
  1023. } MAPINAMEID, FAR * LPMAPINAMEID;
  1024.  
  1025. #define MAPI_IMAPIPROP_METHODS(IPURE)                                   \
  1026.     MAPIMETHOD(GetLastError)                                            \
  1027.         (THIS_  HRESULT                     hResult,                    \
  1028.                 ULONG                       ulFlags,                    \
  1029.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  1030.     MAPIMETHOD(SaveChanges)                                             \
  1031.         (THIS_ ULONG                        ulFlags) IPURE;             \
  1032.     MAPIMETHOD(GetProps)                                                \
  1033.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1034.                 ULONG                       ulFlags,                    \
  1035.                 ULONG FAR *                 lpcValues,                  \
  1036.                 LPSPropValue FAR *          lppPropArray) IPURE;        \
  1037.     MAPIMETHOD(GetPropList)                                             \
  1038.         (THIS_  ULONG                       ulFlags,                    \
  1039.                 LPSPropTagArray FAR *       lppPropTagArray) IPURE;     \
  1040.     MAPIMETHOD(OpenProperty)                                            \
  1041.         (THIS_  ULONG                       ulPropTag,                  \
  1042.                 LPCIID                      lpiid,                      \
  1043.                 ULONG                       ulInterfaceOptions,         \
  1044.                 ULONG                       ulFlags,                    \
  1045.                 LPUNKNOWN FAR *             lppUnk) IPURE;              \
  1046.     MAPIMETHOD(SetProps)                                                \
  1047.         (THIS_  ULONG                       cValues,                    \
  1048.                 LPSPropValue                lpPropArray,                \
  1049.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1050.     MAPIMETHOD(DeleteProps)                                             \
  1051.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1052.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1053.     MAPIMETHOD(CopyTo)                                                  \
  1054.         (THIS_  ULONG                       ciidExclude,                \
  1055.                 LPCIID                      rgiidExclude,               \
  1056.                 LPSPropTagArray             lpExcludeProps,             \
  1057.                 ULONG                       ulUIParam,                  \
  1058.                 LPMAPIPROGRESS              lpProgress,                 \
  1059.                 LPCIID                      lpInterface,                \
  1060.                 LPVOID                      lpDestObj,                  \
  1061.                 ULONG                       ulFlags,                    \
  1062.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1063.     MAPIMETHOD(CopyProps)                                               \
  1064.         (THIS_  LPSPropTagArray             lpIncludeProps,             \
  1065.                 ULONG                       ulUIParam,                  \
  1066.                 LPMAPIPROGRESS              lpProgress,                 \
  1067.                 LPCIID                      lpInterface,                \
  1068.                 LPVOID                      lpDestObj,                  \
  1069.                 ULONG                       ulFlags,                    \
  1070.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1071.     MAPIMETHOD(GetNamesFromIDs)                                         \
  1072.         (THIS_  LPSPropTagArray FAR *       lppPropTags,                \
  1073.                 LPGUID                      lpPropSetGuid,              \
  1074.                 ULONG                       ulFlags,                    \
  1075.                 ULONG FAR *                 lpcPropNames,               \
  1076.                 LPMAPINAMEID FAR * FAR *    lpppPropNames) IPURE;       \
  1077.     MAPIMETHOD(GetIDsFromNames)                                         \
  1078.         (THIS_  ULONG                       cPropNames,                 \
  1079.                 LPMAPINAMEID FAR *          lppPropNames,               \
  1080.                 ULONG                       ulFlags,                    \
  1081.                 LPSPropTagArray FAR *       lppPropTags) IPURE;         \
  1082.  
  1083. #undef       INTERFACE
  1084. #define      INTERFACE  IMAPIProp
  1085. DECLARE_MAPI_INTERFACE_(IMAPIProp, IUnknown)
  1086. {
  1087.     BEGIN_INTERFACE
  1088.     MAPI_IUNKNOWN_METHODS(PURE)
  1089.     MAPI_IMAPIPROP_METHODS(PURE)
  1090. };
  1091.  
  1092. /* IMAPITable Interface ---------------------------------------------------- */
  1093.  
  1094. /* Table status */
  1095.  
  1096. #define TBLSTAT_COMPLETE            ((ULONG) 0)
  1097. #define TBLSTAT_QCHANGED            ((ULONG) 7)
  1098. #define TBLSTAT_SORTING             ((ULONG) 9)
  1099. #define TBLSTAT_SORT_ERROR          ((ULONG) 10)
  1100. #define TBLSTAT_SETTING_COLS        ((ULONG) 11)
  1101. #define TBLSTAT_SETCOL_ERROR        ((ULONG) 13)
  1102. #define TBLSTAT_RESTRICTING         ((ULONG) 14)
  1103. #define TBLSTAT_RESTRICT_ERROR      ((ULONG) 15)
  1104.  
  1105.  
  1106. /* Table Type */
  1107.  
  1108. #define TBLTYPE_SNAPSHOT            ((ULONG) 0)
  1109. #define TBLTYPE_KEYSET              ((ULONG) 1)
  1110. #define TBLTYPE_DYNAMIC             ((ULONG) 2)
  1111.  
  1112.  
  1113. /* Sort order */
  1114.  
  1115. /* bit 0: set if descending, clear if ascending */
  1116.  
  1117. #define TABLE_SORT_ASCEND       ((ULONG) 0x00000000)
  1118. #define TABLE_SORT_DESCEND      ((ULONG) 0x00000001)
  1119. #define TABLE_SORT_COMBINE      ((ULONG) 0x00000002)
  1120.  
  1121.  
  1122. /* Data structures */
  1123.  
  1124. typedef struct _SSortOrder
  1125. {
  1126.     ULONG   ulPropTag;          /* Column to sort on */
  1127.     ULONG   ulOrder;            /* Ascending, descending, combine to left */
  1128. } SSortOrder, FAR * LPSSortOrder;
  1129.  
  1130. typedef struct _SSortOrderSet
  1131. {
  1132.     ULONG           cSorts;     /* Number of sort columns in aSort below*/
  1133.     ULONG           cCategories;    /* 0 for non-categorized, up to cSorts */
  1134.     ULONG           cExpanded;      /* 0 if no categories start expanded, */
  1135.                                     /*      up to cExpanded */
  1136.     SSortOrder      aSort[MAPI_DIM];    /* The sort orders */
  1137. } SSortOrderSet, FAR * LPSSortOrderSet;
  1138.  
  1139. #define CbNewSSortOrderSet(_csort) \
  1140.     (offsetof(SSortOrderSet,aSort) + (_csort)*sizeof(SSortOrder))
  1141. #define CbSSortOrderSet(_lpset) \
  1142.     (offsetof(SSortOrderSet,aSort) + \
  1143.     (UINT)((_lpset)->cSorts*sizeof(SSortOrder)))
  1144. #define SizedSSortOrderSet(_csort, _name) \
  1145. struct _SSortOrderSet_ ## _name \
  1146. { \
  1147.     ULONG           cSorts;         \
  1148.     ULONG           cCategories;    \
  1149.     ULONG           cExpanded;      \
  1150.     SSortOrder      aSort[_csort];  \
  1151. } _name
  1152.  
  1153. typedef ULONG       BOOKMARK;
  1154.  
  1155. #define BOOKMARK_BEGINNING  ((BOOKMARK) 0)      /* Before first row */
  1156. #define BOOKMARK_CURRENT    ((BOOKMARK) 1)      /* Before current row */
  1157. #define BOOKMARK_END        ((BOOKMARK) 2)      /* After last row */
  1158.  
  1159. /* Fuzzy Level */
  1160.  
  1161. #define FL_FULLSTRING       ((ULONG) 0x00000000)
  1162. #define FL_SUBSTRING        ((ULONG) 0x00000001)
  1163. #define FL_PREFIX           ((ULONG) 0x00000002)
  1164.  
  1165. #define FL_IGNORECASE       ((ULONG) 0x00010000)
  1166. #define FL_IGNORENONSPACE   ((ULONG) 0x00020000)
  1167. #define FL_LOOSE            ((ULONG) 0x00040000)
  1168.  
  1169. /* Restrictions */
  1170.  
  1171. typedef struct _SRestriction    FAR * LPSRestriction;
  1172.  
  1173. /* Restriction types */
  1174.  
  1175. #define RES_AND             ((ULONG) 0x00000000)
  1176. #define RES_OR              ((ULONG) 0x00000001)
  1177. #define RES_NOT             ((ULONG) 0x00000002)
  1178. #define RES_CONTENT         ((ULONG) 0x00000003)
  1179. #define RES_PROPERTY        ((ULONG) 0x00000004)
  1180. #define RES_COMPAREPROPS    ((ULONG) 0x00000005)
  1181. #define RES_BITMASK         ((ULONG) 0x00000006)
  1182. #define RES_SIZE            ((ULONG) 0x00000007)
  1183. #define RES_EXIST           ((ULONG) 0x00000008)
  1184. #define RES_SUBRESTRICTION  ((ULONG) 0x00000009)
  1185. #define RES_COMMENT         ((ULONG) 0x0000000A)
  1186.  
  1187. /* Relational operators. These apply to all property comparison restrictions. */
  1188.  
  1189. #define RELOP_LT        ((ULONG) 0)     /* <  */
  1190. #define RELOP_LE        ((ULONG) 1)     /* <= */
  1191. #define RELOP_GT        ((ULONG) 2)     /* >  */
  1192. #define RELOP_GE        ((ULONG) 3)     /* >= */
  1193. #define RELOP_EQ        ((ULONG) 4)     /* == */
  1194. #define RELOP_NE        ((ULONG) 5)     /* != */
  1195. #define RELOP_RE        ((ULONG) 6)     /* LIKE (Regular expression) */
  1196.  
  1197. /* Bitmask operators, for RES_BITMASK only. */
  1198.  
  1199. #define BMR_EQZ     ((ULONG) 0)     /* ==0 */
  1200. #define BMR_NEZ     ((ULONG) 1)     /* !=0 */
  1201.  
  1202. /* Subobject identifiers for RES_SUBRESTRICTION only. See MAPITAGS.H. */
  1203.  
  1204. /* #define PR_MESSAGE_RECIPIENTS  PROP_TAG(PT_OBJECT,0x0E12) */
  1205. /* #define PR_MESSAGE_ATTACHMENTS PROP_TAG(PT_OBJECT,0x0E13) */
  1206.  
  1207. typedef struct _SAndRestriction
  1208. {
  1209.     ULONG           cRes;
  1210.     LPSRestriction  lpRes;
  1211. } SAndRestriction;
  1212.  
  1213. typedef struct _SOrRestriction
  1214. {
  1215.     ULONG           cRes;
  1216.     LPSRestriction  lpRes;
  1217. } SOrRestriction;
  1218.  
  1219. typedef struct _SNotRestriction
  1220. {
  1221.     ULONG           ulReserved;
  1222.     LPSRestriction  lpRes;
  1223. } SNotRestriction;
  1224.  
  1225. typedef struct _SContentRestriction
  1226. {
  1227.     ULONG           ulFuzzyLevel;
  1228.     ULONG           ulPropTag;
  1229.     LPSPropValue    lpProp;
  1230. } SContentRestriction;
  1231.  
  1232. typedef struct _SBitMaskRestriction
  1233. {
  1234.     ULONG           relBMR;
  1235.     ULONG           ulPropTag;
  1236.     ULONG           ulMask;
  1237. } SBitMaskRestriction;
  1238.  
  1239. typedef struct _SPropertyRestriction
  1240. {
  1241.     ULONG           relop;
  1242.     ULONG           ulPropTag;
  1243.     LPSPropValue    lpProp;
  1244. } SPropertyRestriction;
  1245.  
  1246. typedef struct _SComparePropsRestriction
  1247. {
  1248.     ULONG           relop;
  1249.     ULONG           ulPropTag1;
  1250.     ULONG           ulPropTag2;
  1251. } SComparePropsRestriction;
  1252.  
  1253. typedef struct _SSizeRestriction
  1254. {
  1255.     ULONG           relop;
  1256.     ULONG           ulPropTag;
  1257.     ULONG           cb;
  1258. } SSizeRestriction;
  1259.  
  1260. typedef struct _SExistRestriction
  1261. {
  1262.     ULONG           ulReserved1;
  1263.     ULONG           ulPropTag;
  1264.     ULONG           ulReserved2;
  1265. } SExistRestriction;
  1266.  
  1267. typedef struct _SSubRestriction
  1268. {
  1269.     ULONG           ulSubObject;
  1270.     LPSRestriction  lpRes;
  1271. } SSubRestriction;
  1272.  
  1273. typedef struct _SCommentRestriction
  1274. {
  1275.     ULONG           cValues; /* # of properties in lpProp */
  1276.     LPSRestriction  lpRes;
  1277.     LPSPropValue    lpProp;
  1278. } SCommentRestriction;
  1279.  
  1280. typedef struct _SRestriction
  1281. {
  1282.     ULONG   rt;         /* Restriction type */
  1283.     union
  1284.     {
  1285.         SComparePropsRestriction    resCompareProps;    /* first */
  1286.         SAndRestriction             resAnd;
  1287.         SOrRestriction              resOr;
  1288.         SNotRestriction             resNot;
  1289.         SContentRestriction         resContent;
  1290.         SPropertyRestriction        resProperty;
  1291.         SBitMaskRestriction         resBitMask;
  1292.         SSizeRestriction            resSize;
  1293.         SExistRestriction           resExist;
  1294.         SSubRestriction             resSub;
  1295.         SCommentRestriction         resComment;
  1296.     } res;
  1297. } SRestriction;
  1298.  
  1299. /* SComparePropsRestriction is first in the union so that */
  1300. /* static initializations of 3-value restriction work.    */
  1301.  
  1302. /* Flags of the methods of IMAPITable */
  1303.  
  1304. /* QueryColumn */
  1305.  
  1306. #define TBL_ALL_COLUMNS     ((ULONG) 0x00000001)
  1307.  
  1308. /* QueryRows */
  1309. /* Possible values for PR_ROW_TYPE (for categorization) */
  1310.  
  1311. #define TBL_LEAF_ROW            ((ULONG) 1)
  1312. #define TBL_EMPTY_CATEGORY      ((ULONG) 2)
  1313. #define TBL_EXPANDED_CATEGORY   ((ULONG) 3)
  1314. #define TBL_COLLAPSED_CATEGORY  ((ULONG) 4)
  1315.  
  1316. /* Table wait flag */
  1317.  
  1318. #define TBL_NOWAIT          ((ULONG) 0x00000001)
  1319. /* alternative name for TBL_NOWAIT */
  1320. #define TBL_ASYNC           ((ULONG) 0x00000001)
  1321. #define TBL_BATCH           ((ULONG) 0x00000002)
  1322.  
  1323. /* FindRow */
  1324.  
  1325. #define DIR_BACKWARD        ((ULONG) 0x00000001)
  1326.  
  1327. /* Table cursor states */
  1328.  
  1329. #define TBL_NOADVANCE       ((ULONG) 0x00000001)
  1330.  
  1331. #define MAPI_IMAPITABLE_METHODS(IPURE)                                  \
  1332.     MAPIMETHOD(GetLastError)                                            \
  1333.         (THIS_  HRESULT                     hResult,                    \
  1334.                 ULONG                       ulFlags,                    \
  1335.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  1336.     MAPIMETHOD(Advise)                                                  \
  1337.         (THIS_  ULONG                       ulEventMask,                \
  1338.                 LPMAPIADVISESINK            lpAdviseSink,               \
  1339.                 ULONG FAR *                 lpulConnection) IPURE;      \
  1340.     MAPIMETHOD(Unadvise)                                                \
  1341.         (THIS_  ULONG                       ulConnection) IPURE;        \
  1342.     MAPIMETHOD(GetStatus)                                               \
  1343.         (THIS_  ULONG FAR *                 lpulTableStatus,            \
  1344.                 ULONG FAR *                 lpulTableType) IPURE;       \
  1345.     MAPIMETHOD(SetColumns)                                              \
  1346.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1347.                 ULONG                       ulFlags) IPURE;             \
  1348.     MAPIMETHOD(QueryColumns)                                            \
  1349.         (THIS_  ULONG                       ulFlags,                    \
  1350.                 LPSPropTagArray FAR *       lpPropTagArray) IPURE;      \
  1351.     MAPIMETHOD(GetRowCount)                                             \
  1352.         (THIS_  ULONG                       ulFlags,                    \
  1353.                 ULONG FAR *                 lpulCount) IPURE;           \
  1354.     MAPIMETHOD(SeekRow)                                                 \
  1355.         (THIS_  BOOKMARK                    bkOrigin,                   \
  1356.                 LONG                        lRowCount,                  \
  1357.                 LONG FAR *                  lplRowsSought) IPURE;       \
  1358.     MAPIMETHOD(SeekRowApprox)                                           \
  1359.         (THIS_  ULONG                       ulNumerator,                \
  1360.                 ULONG                       ulDenominator) IPURE;       \
  1361.     MAPIMETHOD(QueryPosition)                                           \
  1362.         (THIS_  ULONG FAR *                 lpulRow,                    \
  1363.                 ULONG FAR *                 lpulNumerator,              \
  1364.                 ULONG FAR *                 lpulDenominator) IPURE;     \
  1365.     MAPIMETHOD(FindRow)                                                 \
  1366.         (THIS_  LPSRestriction              lpRestriction,              \
  1367.                 BOOKMARK                    bkOrigin,                   \
  1368.                 ULONG                       ulFlags) IPURE;             \
  1369.     MAPIMETHOD(Restrict)                                                \
  1370.         (THIS_  LPSRestriction              lpRestriction,              \
  1371.                 ULONG                       ulFlags) IPURE;             \
  1372.     MAPIMETHOD(CreateBookmark)                                          \
  1373.         (THIS_  BOOKMARK FAR *              lpbkPosition) IPURE;        \
  1374.     MAPIMETHOD(FreeBookmark)                                            \
  1375.         (THIS_  BOOKMARK                    bkPosition) IPURE;          \
  1376.     MAPIMETHOD(SortTable)                                               \
  1377.         (THIS_  LPSSortOrderSet             lpSortCriteria,             \
  1378.                 ULONG                       ulFlags) IPURE;             \
  1379.     MAPIMETHOD(QuerySortOrder)                                          \
  1380.         (THIS_  LPSSortOrderSet FAR *       lppSortCriteria) IPURE;     \
  1381.     MAPIMETHOD(QueryRows)                                               \
  1382.         (THIS_  LONG                        lRowCount,                  \
  1383.                 ULONG                       ulFlags,                    \
  1384.                 LPSRowSet FAR *             lppRows) IPURE;             \
  1385.     MAPIMETHOD(Abort) (THIS) IPURE;                                     \
  1386.     MAPIMETHOD(ExpandRow)                                               \
  1387.         (THIS_  ULONG                       cbInstanceKey,              \
  1388.                 LPBYTE                      pbInstanceKey,              \
  1389.                 ULONG                       ulRowCount,                 \
  1390.                 ULONG                       ulFlags,                    \
  1391.                 LPSRowSet FAR *             lppRows,                    \
  1392.                 ULONG FAR *                 lpulMoreRows) IPURE;        \
  1393.     MAPIMETHOD(CollapseRow)                                             \
  1394.         (THIS_  ULONG                       cbInstanceKey,              \
  1395.                 LPBYTE                      pbInstanceKey,              \
  1396.                 ULONG                       ulFlags,                    \
  1397.                 ULONG FAR *                 lpulRowCount) IPURE;        \
  1398.     MAPIMETHOD(WaitForCompletion)                                       \
  1399.         (THIS_  ULONG                       ulFlags,                    \
  1400.                 ULONG                       ulTimeout,                  \
  1401.                 ULONG FAR *                 lpulTableStatus) IPURE;     \
  1402.     MAPIMETHOD(GetCollapseState)                                        \
  1403.         (THIS_  ULONG                       ulFlags,                    \
  1404.                 ULONG                       cbInstanceKey,              \
  1405.                 LPBYTE                      lpbInstanceKey,             \
  1406.                 ULONG FAR *                 lpcbCollapseState,          \
  1407.                 LPBYTE FAR *                lppbCollapseState) IPURE;   \
  1408.     MAPIMETHOD(SetCollapseState)                                        \
  1409.         (THIS_  ULONG                       ulFlags,                    \
  1410.                 ULONG                       cbCollapseState,            \
  1411.                 LPBYTE                      pbCollapseState,            \
  1412.                 BOOKMARK FAR *              lpbkLocation) IPURE;        \
  1413.  
  1414. #undef       INTERFACE
  1415. #define      INTERFACE  IMAPITable
  1416. DECLARE_MAPI_INTERFACE_(IMAPITable, IUnknown)
  1417. {
  1418.     BEGIN_INTERFACE
  1419.     MAPI_IUNKNOWN_METHODS(PURE)
  1420.     MAPI_IMAPITABLE_METHODS(PURE)
  1421. };
  1422.  
  1423. /* IProfSect Interface ----------------------------------------------------- */
  1424.  
  1425. /* Standard section for public profile properties */
  1426.  
  1427. #define PS_PROFILE_PROPERTIES_INIT \
  1428. {   0x98, 0x15, 0xAC, 0x08, 0xAA, 0xB0, 0x10, 0x1A, \
  1429.     0x8C, 0x93, 0x08, 0x00, 0x2B, 0x2A, 0x56, 0xC2  }
  1430.  
  1431.  
  1432. #define MAPI_IPROFSECT_METHODS(IPURE)
  1433.  
  1434. #undef       INTERFACE
  1435. #define      INTERFACE  IProfSect
  1436. DECLARE_MAPI_INTERFACE_(IProfSect, IMAPIProp)
  1437. {
  1438.     BEGIN_INTERFACE
  1439.     MAPI_IUNKNOWN_METHODS(PURE)
  1440.     MAPI_IMAPIPROP_METHODS(PURE)
  1441.     MAPI_IPROFSECT_METHODS(PURE)
  1442. };
  1443.  
  1444. /* IMAPIStatus Interface --------------------------------------------------- */
  1445.  
  1446. /* Values for PR_RESOURCE_TYPE, _METHODS, _FLAGS */
  1447.  
  1448. #define MAPI_STORE_PROVIDER     ((ULONG) 33)    /* Message Store */
  1449. #define MAPI_AB                 ((ULONG) 34)    /* Address Book */
  1450. #define MAPI_AB_PROVIDER        ((ULONG) 35)    /* Address Book Provider */
  1451. #define MAPI_TRANSPORT_PROVIDER ((ULONG) 36)    /* Transport Provider */
  1452. #define MAPI_SPOOLER            ((ULONG) 37)    /* Message Spooler */
  1453. #define MAPI_PROFILE_PROVIDER   ((ULONG) 38)    /* Profile Provider */
  1454. #define MAPI_SUBSYSTEM          ((ULONG) 39)    /* Overall Subsystem Status */
  1455. #define MAPI_HOOK_PROVIDER      ((ULONG) 40)    /* Spooler Hook */
  1456.  
  1457. #define STATUS_VALIDATE_STATE   ((ULONG) 0x00000001)
  1458. #define STATUS_SETTINGS_DIALOG  ((ULONG) 0x00000002)
  1459. #define STATUS_CHANGE_PASSWORD  ((ULONG) 0x00000004)
  1460. #define STATUS_FLUSH_QUEUES     ((ULONG) 0x00000008)
  1461.  
  1462. #define STATUS_DEFAULT_OUTBOUND ((ULONG) 0x00000001)
  1463. #define STATUS_DEFAULT_STORE    ((ULONG) 0x00000002)
  1464. #define STATUS_PRIMARY_IDENTITY ((ULONG) 0x00000004)
  1465. #define STATUS_SIMPLE_STORE     ((ULONG) 0x00000008)
  1466. #define STATUS_XP_PREFER_LAST   ((ULONG) 0x00000010)
  1467. #define STATUS_NO_PRIMARY_IDENTITY ((ULONG) 0x00000020)
  1468. #define STATUS_NO_DEFAULT_STORE ((ULONG) 0x00000040)
  1469. #define STATUS_TEMP_SECTION     ((ULONG) 0x00000080)
  1470. #define STATUS_OWN_STORE        ((ULONG) 0x00000100)
  1471. /****** HOOK_INBOUND            ((ULONG) 0x00000200) Defined in MAPIHOOK.H */
  1472. /****** HOOK_OUTBOUND           ((ULONG) 0x00000400) Defined in MAPIHOOK.H */
  1473. #define STATUS_NEED_IPM_TREE    ((ULONG) 0x00000800)
  1474. #define STATUS_PRIMARY_STORE    ((ULONG) 0x00001000)
  1475. #define STATUS_SECONDARY_STORE  ((ULONG) 0x00002000)
  1476.  
  1477.  
  1478. /*
  1479.  * PR_STATUS_CODE bit. Low 16 bits for common values; High 16 bits
  1480.  * for provider type-specific values. (DCR 304)
  1481.  */
  1482.  
  1483. #define STATUS_AVAILABLE        ((ULONG) 0x00000001)
  1484. #define STATUS_OFFLINE          ((ULONG) 0x00000002)
  1485. #define STATUS_FAILURE          ((ULONG) 0x00000004)
  1486.  
  1487. /* Transport values of PR_STATUS_CODE */
  1488.  
  1489. #define STATUS_INBOUND_ENABLED  ((ULONG) 0x00010000)
  1490. #define STATUS_INBOUND_ACTIVE   ((ULONG) 0x00020000)
  1491. #define STATUS_INBOUND_FLUSH    ((ULONG) 0x00040000)
  1492. #define STATUS_OUTBOUND_ENABLED ((ULONG) 0x00100000)
  1493. #define STATUS_OUTBOUND_ACTIVE  ((ULONG) 0x00200000)
  1494. #define STATUS_OUTBOUND_FLUSH   ((ULONG) 0x00400000)
  1495. #define STATUS_REMOTE_ACCESS    ((ULONG) 0x00800000)
  1496.  
  1497. /* ValidateState flags */
  1498.  
  1499. #define SUPPRESS_UI                 ((ULONG) 0x00000001)
  1500. #define REFRESH_XP_HEADER_CACHE     ((ULONG) 0x00010000)
  1501. #define PROCESS_XP_HEADER_CACHE     ((ULONG) 0x00020000)
  1502. #define FORCE_XP_CONNECT            ((ULONG) 0x00040000)
  1503. #define FORCE_XP_DISCONNECT         ((ULONG) 0x00080000)
  1504. #define CONFIG_CHANGED              ((ULONG) 0x00100000)
  1505. #define ABORT_XP_HEADER_OPERATION   ((ULONG) 0x00200000)
  1506. #define SHOW_XP_SESSION_UI          ((ULONG) 0x00400000)
  1507.  
  1508. /* SettingsDialog flags */
  1509.  
  1510. #define UI_READONLY     ((ULONG) 0x00000001)
  1511.  
  1512. /* FlushQueues flags */
  1513.  
  1514. #define FLUSH_UPLOAD        ((ULONG) 0x00000002)
  1515. #define FLUSH_DOWNLOAD      ((ULONG) 0x00000004)
  1516. #define FLUSH_FORCE         ((ULONG) 0x00000008)
  1517. #define FLUSH_NO_UI         ((ULONG) 0x00000010)
  1518. #define FLUSH_ASYNC_OK      ((ULONG) 0x00000020)
  1519.  
  1520. #define MAPI_IMAPISTATUS_METHODS(IPURE)                                 \
  1521.     MAPIMETHOD(ValidateState)                                           \
  1522.         (THIS_  ULONG                       ulUIParam,                  \
  1523.                 ULONG                       ulFlags) IPURE;             \
  1524.     MAPIMETHOD(SettingsDialog)                                          \
  1525.         (THIS_  ULONG                       ulUIParam,                  \
  1526.                 ULONG                       ulFlags) IPURE;             \
  1527.     MAPIMETHOD(ChangePassword)                                          \
  1528.         (THIS_  LPTSTR                      lpOldPass,                  \
  1529.                 LPTSTR                      lpNewPass,                  \
  1530.                 ULONG                       ulFlags) IPURE;             \
  1531.     MAPIMETHOD(FlushQueues)                                             \
  1532.         (THIS_  ULONG                       ulUIParam,                  \
  1533.                 ULONG                       cbTargetTransport,          \
  1534.                 LPENTRYID                   lpTargetTransport,          \
  1535.                 ULONG                       ulFlags) IPURE;             \
  1536.  
  1537. #undef       INTERFACE
  1538. #define      INTERFACE  IMAPIStatus
  1539. DECLARE_MAPI_INTERFACE_(IMAPIStatus, IMAPIProp)
  1540. {
  1541.     BEGIN_INTERFACE
  1542.     MAPI_IUNKNOWN_METHODS(PURE)
  1543.     MAPI_IMAPIPROP_METHODS(PURE)
  1544.     MAPI_IMAPISTATUS_METHODS(PURE)
  1545. };
  1546.  
  1547. /* IMAPIContainer Interface ------------------------------------------------ */
  1548.  
  1549. /* Flags for OpenEntry() */
  1550.  
  1551. /****** MAPI_MODIFY             ((ULONG) 0x00000001) above */
  1552. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1553. #define MAPI_BEST_ACCESS        ((ULONG) 0x00000010)
  1554.  
  1555. /* GetContentsTable() */
  1556. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1557. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1558. /****** MAPI_ASSOCIATED         ((ULONG) 0x00000040) below */
  1559.  
  1560. /* GetHierarchyTable() */
  1561. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1562. #define CONVENIENT_DEPTH        ((ULONG) 0x00000001)
  1563. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1564.  
  1565. /* GetSearchCriteria */
  1566. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1567. #define SEARCH_RUNNING          ((ULONG) 0x00000001)
  1568. #define SEARCH_REBUILD          ((ULONG) 0x00000002)
  1569. #define SEARCH_RECURSIVE        ((ULONG) 0x00000004)
  1570. #define SEARCH_FOREGROUND       ((ULONG) 0x00000008)
  1571.  
  1572. /* SetSearchCriteria */
  1573. #define STOP_SEARCH             ((ULONG) 0x00000001)
  1574. #define RESTART_SEARCH          ((ULONG) 0x00000002)
  1575. #define RECURSIVE_SEARCH        ((ULONG) 0x00000004)
  1576. #define SHALLOW_SEARCH          ((ULONG) 0x00000008)
  1577. #define FOREGROUND_SEARCH       ((ULONG) 0x00000010)
  1578. #define BACKGROUND_SEARCH       ((ULONG) 0x00000020)
  1579.  
  1580. #define MAPI_IMAPICONTAINER_METHODS(IPURE)                              \
  1581.     MAPIMETHOD(GetContentsTable)                                        \
  1582.         (THIS_  ULONG                       ulFlags,                    \
  1583.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  1584.     MAPIMETHOD(GetHierarchyTable)                                       \
  1585.         (THIS_  ULONG                       ulFlags,                    \
  1586.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  1587.     MAPIMETHOD(OpenEntry)                                               \
  1588.         (THIS_  ULONG                       cbEntryID,                  \
  1589.                 LPENTRYID                   lpEntryID,                  \
  1590.                 LPCIID                      lpInterface,                \
  1591.                 ULONG                       ulFlags,                    \
  1592.                 ULONG FAR *                 lpulObjType,                \
  1593.                 LPUNKNOWN FAR *             lppUnk) IPURE;              \
  1594.     MAPIMETHOD(SetSearchCriteria)                                       \
  1595.         (THIS_  LPSRestriction              lpRestriction,              \
  1596.                 LPENTRYLIST                 lpContainerList,            \
  1597.                 ULONG                       ulSearchFlags) IPURE;       \
  1598.     MAPIMETHOD(GetSearchCriteria)                                       \
  1599.         (THIS_  ULONG                       ulFlags,                    \
  1600.                 LPSRestriction FAR *        lppRestriction,             \
  1601.                 LPENTRYLIST FAR *           lppContainerList,           \
  1602.                 ULONG FAR *                 lpulSearchState)IPURE;      \
  1603.  
  1604. #undef       INTERFACE
  1605. #define      INTERFACE  IMAPIContainer
  1606. DECLARE_MAPI_INTERFACE_(IMAPIContainer, IMAPIProp)
  1607. {
  1608.     BEGIN_INTERFACE
  1609.     MAPI_IUNKNOWN_METHODS(PURE)
  1610.     MAPI_IMAPIPROP_METHODS(PURE)
  1611.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1612. };
  1613.  
  1614. /* IABContainer Interface -------------------------------------------------- */
  1615.  
  1616. /*
  1617.  *  IABContainer PR_CONTAINER_FLAGS values
  1618.  *  If AB_UNMODIFIABLE and AB_MODIFIABLE are both set, it means the container
  1619.  *  doesn't know if it's modifiable or not, and the client should
  1620.  *  try to modify the contents but we won't expect it to work.
  1621.  *  If the AB_RECIPIENTS flag is set and neither AB_MODIFIABLE or AB_UNMODIFIABLE
  1622.  *  bits are set, it is an error.
  1623.  */
  1624.  
  1625. typedef struct _flaglist
  1626. {
  1627.     ULONG cFlags;
  1628.     ULONG ulFlag[MAPI_DIM];
  1629. } FlagList, FAR * LPFlagList;
  1630.  
  1631.  
  1632. /*
  1633.  *  Container flags
  1634.  */
  1635. #define AB_RECIPIENTS           ((ULONG) 0x00000001)
  1636. #define AB_SUBCONTAINERS        ((ULONG) 0x00000002)
  1637. #define AB_MODIFIABLE           ((ULONG) 0x00000004)
  1638. #define AB_UNMODIFIABLE         ((ULONG) 0x00000008)
  1639. #define AB_FIND_ON_OPEN         ((ULONG) 0x00000010)
  1640. #define AB_NOT_DEFAULT          ((ULONG) 0x00000020)
  1641.  
  1642. /* CreateEntry() */
  1643.  
  1644. #define CREATE_CHECK_DUP_STRICT ((ULONG) 0x00000001)
  1645. #define CREATE_CHECK_DUP_LOOSE  ((ULONG) 0x00000002)
  1646. #define CREATE_REPLACE          ((ULONG) 0x00000004)
  1647.  
  1648. /* ResolveNames() - ulFlags */
  1649. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1650.  
  1651. /* ResolveNames() - rgulFlags */
  1652. #define MAPI_UNRESOLVED         ((ULONG) 0x00000000)
  1653. #define MAPI_AMBIGUOUS          ((ULONG) 0x00000001)
  1654. #define MAPI_RESOLVED           ((ULONG) 0x00000002)
  1655.  
  1656.  
  1657. #define MAPI_IABCONTAINER_METHODS(IPURE)                                \
  1658.     MAPIMETHOD(CreateEntry)                                             \
  1659.         (THIS_  ULONG                       cbEntryID,                  \
  1660.                 LPENTRYID                   lpEntryID,                  \
  1661.                 ULONG                       ulCreateFlags,              \
  1662.                 LPMAPIPROP FAR  *           lppMAPIPropEntry) IPURE;    \
  1663.     MAPIMETHOD(CopyEntries)                                             \
  1664.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1665.                 ULONG                       ulUIParam,                  \
  1666.                 LPMAPIPROGRESS              lpProgress,                 \
  1667.                 ULONG                       ulFlags) IPURE;             \
  1668.     MAPIMETHOD(DeleteEntries)                                           \
  1669.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1670.                 ULONG                       ulFlags) IPURE;             \
  1671.     MAPIMETHOD(ResolveNames)                                            \
  1672.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1673.                 ULONG                       ulFlags,                    \
  1674.                 LPADRLIST                   lpAdrList,                  \
  1675.                 LPFlagList                  lpFlagList) IPURE;          \
  1676.  
  1677. #undef       INTERFACE
  1678. #define      INTERFACE  IABContainer
  1679. DECLARE_MAPI_INTERFACE_(IABContainer, IMAPIContainer)
  1680. {
  1681.     BEGIN_INTERFACE
  1682.     MAPI_IUNKNOWN_METHODS(PURE)
  1683.     MAPI_IMAPIPROP_METHODS(PURE)
  1684.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1685.     MAPI_IABCONTAINER_METHODS(PURE)
  1686. };
  1687.  
  1688. /* IMailUser Interface ----------------------------------------------------- */
  1689.  
  1690. /*  Any call which can create a one-off entryID (i.e. MAPISupport::CreateOneOff
  1691.     or IAdrBook::CreateOneOff) can encode the value for PR_SEND_RICH_INFO by
  1692.     passing in the following flag in the ulFlags parameter.  Setting this flag
  1693.     indicates that PR_SEND_RICH_INFO will be FALSE.
  1694. */
  1695. #define MAPI_SEND_NO_RICH_INFO      ((ULONG) 0x00010000)
  1696.  
  1697.  
  1698.  
  1699.  
  1700. /* Values of PR_NDR_DIAG_CODE */
  1701.  
  1702. #define MAPI_DIAG(_code)    ((LONG) _code)
  1703.  
  1704. #define MAPI_DIAG_NO_DIAGNOSTIC                     MAPI_DIAG( -1 )
  1705. #define MAPI_DIAG_OR_NAME_UNRECOGNIZED              MAPI_DIAG( 0 )
  1706. #define MAPI_DIAG_OR_NAME_AMBIGUOUS                 MAPI_DIAG( 1 )
  1707. #define MAPI_DIAG_MTS_CONGESTED                     MAPI_DIAG( 2 )
  1708. #define MAPI_DIAG_LOOP_DETECTED                     MAPI_DIAG( 3 )
  1709. #define MAPI_DIAG_RECIPIENT_UNAVAILABLE             MAPI_DIAG( 4 )
  1710. #define MAPI_DIAG_MAXIMUM_TIME_EXPIRED              MAPI_DIAG( 5 )
  1711. #define MAPI_DIAG_EITS_UNSUPPORTED                  MAPI_DIAG( 6 )
  1712. #define MAPI_DIAG_CONTENT_TOO_LONG                  MAPI_DIAG( 7 )
  1713. #define MAPI_DIAG_IMPRACTICAL_TO_CONVERT            MAPI_DIAG( 8 )
  1714. #define MAPI_DIAG_PROHIBITED_TO_CONVERT             MAPI_DIAG( 9 )
  1715. #define MAPI_DIAG_CONVERSION_UNSUBSCRIBED           MAPI_DIAG( 10 )
  1716. #define MAPI_DIAG_PARAMETERS_INVALID                MAPI_DIAG( 11 )
  1717. #define MAPI_DIAG_CONTENT_SYNTAX_IN_ERROR           MAPI_DIAG( 12 )
  1718. #define MAPI_DIAG_LENGTH_CONSTRAINT_VIOLATD         MAPI_DIAG( 13 )
  1719. #define MAPI_DIAG_NUMBER_CONSTRAINT_VIOLATD         MAPI_DIAG( 14 )
  1720. #define MAPI_DIAG_CONTENT_TYPE_UNSUPPORTED          MAPI_DIAG( 15 )
  1721. #define MAPI_DIAG_TOO_MANY_RECIPIENTS               MAPI_DIAG( 16 )
  1722. #define MAPI_DIAG_NO_BILATERAL_AGREEMENT            MAPI_DIAG( 17 )
  1723. #define MAPI_DIAG_CRITICAL_FUNC_UNSUPPORTED         MAPI_DIAG( 18 )
  1724. #define MAPI_DIAG_CONVERSION_LOSS_PROHIB            MAPI_DIAG( 19 )
  1725. #define MAPI_DIAG_LINE_TOO_LONG                     MAPI_DIAG( 20 )
  1726. #define MAPI_DIAG_PAGE_TOO_LONG                     MAPI_DIAG( 21 )
  1727. #define MAPI_DIAG_PICTORIAL_SYMBOL_LOST             MAPI_DIAG( 22 )
  1728. #define MAPI_DIAG_PUNCTUATION_SYMBOL_LOST           MAPI_DIAG( 23 )
  1729. #define MAPI_DIAG_ALPHABETIC_CHARACTER_LOST         MAPI_DIAG( 24 )
  1730. #define MAPI_DIAG_MULTIPLE_INFO_LOSSES              MAPI_DIAG( 25 )
  1731. #define MAPI_DIAG_REASSIGNMENT_PROHIBITED           MAPI_DIAG( 26 )
  1732. #define MAPI_DIAG_REDIRECTION_LOOP_DETECTED         MAPI_DIAG( 27 )
  1733. #define MAPI_DIAG_EXPANSION_PROHIBITED              MAPI_DIAG( 28 )
  1734. #define MAPI_DIAG_SUBMISSION_PROHIBITED             MAPI_DIAG( 29 )
  1735. #define MAPI_DIAG_EXPANSION_FAILED                  MAPI_DIAG( 30 )
  1736. #define MAPI_DIAG_RENDITION_UNSUPPORTED             MAPI_DIAG( 31 )
  1737. #define MAPI_DIAG_MAIL_ADDRESS_INCORRECT            MAPI_DIAG( 32 )
  1738. #define MAPI_DIAG_MAIL_OFFICE_INCOR_OR_INVD         MAPI_DIAG( 33 )
  1739. #define MAPI_DIAG_MAIL_ADDRESS_INCOMPLETE           MAPI_DIAG( 34 )
  1740. #define MAPI_DIAG_MAIL_RECIPIENT_UNKNOWN            MAPI_DIAG( 35 )
  1741. #define MAPI_DIAG_MAIL_RECIPIENT_DECEASED           MAPI_DIAG( 36 )
  1742. #define MAPI_DIAG_MAIL_ORGANIZATION_EXPIRED         MAPI_DIAG( 37 )
  1743. #define MAPI_DIAG_MAIL_REFUSED                      MAPI_DIAG( 38 )
  1744. #define MAPI_DIAG_MAIL_UNCLAIMED                    MAPI_DIAG( 39 )
  1745. #define MAPI_DIAG_MAIL_RECIPIENT_MOVED              MAPI_DIAG( 40 )
  1746. #define MAPI_DIAG_MAIL_RECIPIENT_TRAVELLING         MAPI_DIAG( 41 )
  1747. #define MAPI_DIAG_MAIL_RECIPIENT_DEPARTED           MAPI_DIAG( 42 )
  1748. #define MAPI_DIAG_MAIL_NEW_ADDRESS_UNKNOWN          MAPI_DIAG( 43 )
  1749. #define MAPI_DIAG_MAIL_FORWARDING_UNWANTED          MAPI_DIAG( 44 )
  1750. #define MAPI_DIAG_MAIL_FORWARDING_PROHIB            MAPI_DIAG( 45 )
  1751. #define MAPI_DIAG_SECURE_MESSAGING_ERROR            MAPI_DIAG( 46 )
  1752. #define MAPI_DIAG_DOWNGRADING_IMPOSSIBLE            MAPI_DIAG( 47 )
  1753.  
  1754. /* Values of PR_DELIVERY_POINT (MH_T_DELIVERY_POINT) */
  1755.  
  1756. #define MAPI_MH_DP_PUBLIC_UA                        ((ULONG) 0)
  1757. #define MAPI_MH_DP_PRIVATE_UA                       ((ULONG) 1)
  1758. #define MAPI_MH_DP_MS                               ((ULONG) 2)
  1759. #define MAPI_MH_DP_ML                               ((ULONG) 3)
  1760. #define MAPI_MH_DP_PDAU                             ((ULONG) 4)
  1761. #define MAPI_MH_DP_PDS_PATRON                       ((ULONG) 5)
  1762. #define MAPI_MH_DP_OTHER_AU                         ((ULONG) 6)
  1763.  
  1764.  
  1765. #define MAPI_IMAILUSER_METHODS(IPURE)
  1766.  
  1767. #undef       INTERFACE
  1768. #define      INTERFACE  IMailUser
  1769. DECLARE_MAPI_INTERFACE_(IMailUser, IMAPIProp)
  1770. {
  1771.     BEGIN_INTERFACE
  1772.     MAPI_IUNKNOWN_METHODS(PURE)
  1773.     MAPI_IMAPIPROP_METHODS(PURE)
  1774.     MAPI_IMAILUSER_METHODS(PURE)
  1775. };
  1776.  
  1777. /* IDistList Interface ----------------------------------------------------- */
  1778.  
  1779. #define MAPI_IDISTLIST_METHODS(IPURE)                                   \
  1780.     MAPIMETHOD(CreateEntry)                                             \
  1781.         (THIS_  ULONG                       cbEntryID,                  \
  1782.                 LPENTRYID                   lpEntryID,                  \
  1783.                 ULONG                       ulCreateFlags,              \
  1784.                 LPMAPIPROP FAR  *           lppMAPIPropEntry) IPURE;    \
  1785.     MAPIMETHOD(CopyEntries)                                             \
  1786.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1787.                 ULONG                       ulUIParam,                  \
  1788.                 LPMAPIPROGRESS              lpProgress,                 \
  1789.                 ULONG                       ulFlags) IPURE;             \
  1790.     MAPIMETHOD(DeleteEntries)                                           \
  1791.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1792.                 ULONG                       ulFlags) IPURE;             \
  1793.     MAPIMETHOD(ResolveNames)                                            \
  1794.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1795.                 ULONG                       ulFlags,                    \
  1796.                 LPADRLIST                   lpAdrList,                  \
  1797.                 LPFlagList                  lpFlagList) IPURE;          \
  1798.  
  1799. #undef       INTERFACE
  1800. #define      INTERFACE  IDistList
  1801. DECLARE_MAPI_INTERFACE_(IDistList, IMAPIContainer)
  1802. {
  1803.     BEGIN_INTERFACE
  1804.     MAPI_IUNKNOWN_METHODS(PURE)
  1805.     MAPI_IMAPIPROP_METHODS(PURE)
  1806.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1807.     MAPI_IDISTLIST_METHODS(PURE)
  1808. };
  1809.  
  1810. /* IMAPIFolder Interface --------------------------------------------------- */
  1811.  
  1812. /* IMAPIFolder folder type (enum) */
  1813.  
  1814. #define FOLDER_ROOT             ((ULONG) 0x00000000)
  1815. #define FOLDER_GENERIC          ((ULONG) 0x00000001)
  1816. #define FOLDER_SEARCH           ((ULONG) 0x00000002)
  1817.  
  1818. /* CreateMessage */
  1819. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1820. /****** MAPI_ASSOCIATED         ((ULONG) 0x00000040) below */
  1821.  
  1822. /* CopyMessages */
  1823.  
  1824. #define MESSAGE_MOVE            ((ULONG) 0x00000001)
  1825. #define MESSAGE_DIALOG          ((ULONG) 0x00000002)
  1826. /****** MAPI_DECLINE_OK         ((ULONG) 0x00000004) above */
  1827.  
  1828. /* CreateFolder */
  1829.  
  1830. #define OPEN_IF_EXISTS          ((ULONG) 0x00000001)
  1831. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1832. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1833.  
  1834. /* DeleteFolder */
  1835.  
  1836. #define DEL_MESSAGES            ((ULONG) 0x00000001)
  1837. #define FOLDER_DIALOG           ((ULONG) 0x00000002)
  1838. #define DEL_FOLDERS             ((ULONG) 0x00000004)
  1839.  
  1840. /* EmptyFolder */
  1841. #define DEL_ASSOCIATED          ((ULONG) 0x00000008)
  1842.  
  1843. /* CopyFolder */
  1844.  
  1845. #define FOLDER_MOVE             ((ULONG) 0x00000001)
  1846. /****** FOLDER_DIALOG           ((ULONG) 0x00000002) above */
  1847. /****** MAPI_DECLINE_OK         ((ULONG) 0x00000004) above */
  1848. #define COPY_SUBFOLDERS         ((ULONG) 0x00000010)
  1849. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1850.  
  1851.  
  1852. /* SetReadFlags */
  1853.  
  1854. /****** SUPPRESS_RECEIPT        ((ULONG) 0x00000001) below */
  1855. /****** FOLDER_DIALOG           ((ULONG) 0x00000002) above */
  1856. /****** CLEAR_READ_FLAG         ((ULONG) 0x00000004) below */
  1857. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1858. /****** GENERATE_RECEIPT_ONLY   ((ULONG) 0x00000010) below */
  1859. /****** CLEAR_RN_PENDING        ((ULONG) 0x00000020) below */
  1860. /****** CLEAR_NRN_PENDING       ((ULONG) 0x00000040) below */
  1861.  
  1862.  
  1863. /* GetMessageStatus */
  1864.  
  1865. #define MSGSTATUS_HIGHLIGHTED   ((ULONG) 0x00000001)
  1866. #define MSGSTATUS_TAGGED        ((ULONG) 0x00000002)
  1867. #define MSGSTATUS_HIDDEN        ((ULONG) 0x00000004)
  1868. #define MSGSTATUS_DELMARKED     ((ULONG) 0x00000008)
  1869.  
  1870. /* Bits for remote message status */
  1871.  
  1872. #define MSGSTATUS_REMOTE_DOWNLOAD   ((ULONG) 0x00001000)
  1873. #define MSGSTATUS_REMOTE_DELETE     ((ULONG) 0x00002000)
  1874.  
  1875. /* SaveContentsSort */
  1876.  
  1877. #define RECURSIVE_SORT          ((ULONG) 0x00000002)
  1878.  
  1879. /* PR_STATUS property */
  1880.  
  1881. #define FLDSTATUS_HIGHLIGHTED   ((ULONG) 0x00000001)
  1882. #define FLDSTATUS_TAGGED        ((ULONG) 0x00000002)
  1883. #define FLDSTATUS_HIDDEN        ((ULONG) 0x00000004)
  1884. #define FLDSTATUS_DELMARKED     ((ULONG) 0x00000008)
  1885.  
  1886. #define MAPI_IMAPIFOLDER_METHODS(IPURE)                                 \
  1887.     MAPIMETHOD(CreateMessage)                                           \
  1888.         (THIS_  LPCIID                      lpInterface,                \
  1889.                 ULONG                       ulFlags,                    \
  1890.                 LPMESSAGE FAR *             lppMessage) IPURE;          \
  1891.     MAPIMETHOD(CopyMessages)                                            \
  1892.         (THIS_  LPENTRYLIST                 lpMsgList,                  \
  1893.                 LPCIID                      lpInterface,                \
  1894.                 LPVOID                      lpDestFolder,               \
  1895.                 ULONG                       ulUIParam,                  \
  1896.                 LPMAPIPROGRESS              lpProgress,                 \
  1897.                 ULONG                       ulFlags) IPURE;             \
  1898.     MAPIMETHOD(DeleteMessages)                                          \
  1899.         (THIS_  LPENTRYLIST                 lpMsgList,                  \
  1900.                 ULONG                       ulUIParam,                  \
  1901.                 LPMAPIPROGRESS              lpProgress,                 \
  1902.                 ULONG                       ulFlags) IPURE;             \
  1903.     MAPIMETHOD(CreateFolder)                                            \
  1904.         (THIS_  ULONG                       ulFolderType,               \
  1905.                 LPTSTR                      lpszFolderName,             \
  1906.                 LPTSTR                      lpszFolderComment,          \
  1907.                 LPCIID                      lpInterface,                \
  1908.                 ULONG                       ulFlags,                    \
  1909.                 LPMAPIFOLDER FAR *          lppFolder) IPURE;           \
  1910.     MAPIMETHOD(CopyFolder)                                              \
  1911.         (THIS_  ULONG                       cbEntryID,                  \
  1912.                 LPENTRYID                   lpEntryID,                  \
  1913.                 LPCIID                      lpInterface,                \
  1914.                 LPVOID                      lpDestFolder,               \
  1915.                 LPTSTR                      lpszNewFolderName,          \
  1916.                 ULONG                       ulUIParam,                  \
  1917.                 LPMAPIPROGRESS              lpProgress,                 \
  1918.                 ULONG                       ulFlags) IPURE;             \
  1919.     MAPIMETHOD(DeleteFolder)                                            \
  1920.         (THIS_  ULONG                       cbEntryID,                  \
  1921.                 LPENTRYID                   lpEntryID,                  \
  1922.                 ULONG                       ulUIParam,                  \
  1923.                 LPMAPIPROGRESS              lpProgress,                 \
  1924.                 ULONG                       ulFlags) IPURE;             \
  1925.     MAPIMETHOD(SetReadFlags)                                            \
  1926.         (THIS_  LPENTRYLIST                 lpMsgList,                  \
  1927.                 ULONG                       ulUIParam,                  \
  1928.                 LPMAPIPROGRESS              lpProgress,                 \
  1929.                 ULONG                       ulFlags) IPURE;             \
  1930.     MAPIMETHOD(GetMessageStatus)                                        \
  1931.         (THIS_  ULONG                       cbEntryID,                  \
  1932.                 LPENTRYID                   lpEntryID,                  \
  1933.                 ULONG                       ulFlags,                    \
  1934.                 ULONG FAR *                 lpulMessageStatus) IPURE;   \
  1935.     MAPIMETHOD(SetMessageStatus)                                        \
  1936.         (THIS_  ULONG                       cbEntryID,                  \
  1937.                 LPENTRYID                   lpEntryID,                  \
  1938.                 ULONG                       ulNewStatus,                \
  1939.                 ULONG                       ulNewStatusMask,            \
  1940.                 ULONG FAR *                 lpulOldStatus) IPURE;       \
  1941.     MAPIMETHOD(SaveContentsSort)                                        \
  1942.         (THIS_  LPSSortOrderSet             lpSortCriteria,             \
  1943.                 ULONG                       ulFlags) IPURE;             \
  1944.     MAPIMETHOD(EmptyFolder)                                             \
  1945.         (THIS_  ULONG                       ulUIParam,                  \
  1946.                 LPMAPIPROGRESS              lpProgress,                 \
  1947.                 ULONG                       ulFlags) IPURE;             \
  1948.  
  1949. #undef       INTERFACE
  1950. #define      INTERFACE  IMAPIFolder
  1951. DECLARE_MAPI_INTERFACE_(IMAPIFolder, IMAPIContainer)
  1952. {
  1953.     BEGIN_INTERFACE
  1954.     MAPI_IUNKNOWN_METHODS(PURE)
  1955.     MAPI_IMAPIPROP_METHODS(PURE)
  1956.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1957.     MAPI_IMAPIFOLDER_METHODS(PURE)
  1958. };
  1959.  
  1960. /* IMsgStore Interface ----------------------------------------------------- */
  1961.  
  1962. /*  PR_STORE_SUPPORT_MASK bits */
  1963. #define STORE_ENTRYID_UNIQUE    ((ULONG) 0x00000001)
  1964. #define STORE_READONLY          ((ULONG) 0x00000002)
  1965. #define STORE_SEARCH_OK         ((ULONG) 0x00000004)
  1966. #define STORE_MODIFY_OK         ((ULONG) 0x00000008)
  1967. #define STORE_CREATE_OK         ((ULONG) 0x00000010)
  1968. #define STORE_ATTACH_OK         ((ULONG) 0x00000020)
  1969. #define STORE_OLE_OK            ((ULONG) 0x00000040)
  1970. #define STORE_SUBMIT_OK         ((ULONG) 0x00000080)
  1971. #define STORE_NOTIFY_OK         ((ULONG) 0x00000100)
  1972. #define STORE_MV_PROPS_OK       ((ULONG) 0x00000200)
  1973. #define STORE_CATEGORIZE_OK     ((ULONG) 0x00000400)
  1974. #define STORE_RTF_OK            ((ULONG) 0x00000800)
  1975. #define STORE_RESTRICTION_OK    ((ULONG) 0x00001000)
  1976. #define STORE_SORT_OK           ((ULONG) 0x00002000)
  1977. #define STORE_PUBLIC_FOLDERS    ((ULONG) 0x00004000)
  1978. #define STORE_UNCOMPRESSED_RTF  ((ULONG) 0x00008000)
  1979.  
  1980. /* PR_STORE_STATE bits, try not to collide with PR_STORE_SUPPORT_MASK */
  1981.  
  1982. #define STORE_HAS_SEARCHES      ((ULONG) 0x01000000)
  1983.  
  1984.  
  1985. /* OpenEntry() */
  1986.  
  1987. /****** MAPI_MODIFY             ((ULONG) 0x00000001) above */
  1988. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1989. /****** MAPI_BEST_ACCESS        ((ULONG) 0x00000010) above */
  1990.  
  1991. /* SetReceiveFolder() */
  1992.  
  1993. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1994.  
  1995. /* GetReceiveFolder() */
  1996.  
  1997. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1998.  
  1999. /* GetReceiveFolderTable() */
  2000.  
  2001. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  2002.  
  2003. /* StoreLogoff() */
  2004.  
  2005. #define LOGOFF_NO_WAIT          ((ULONG) 0x00000001)
  2006. #define LOGOFF_ORDERLY          ((ULONG) 0x00000002)
  2007. #define LOGOFF_PURGE            ((ULONG) 0x00000004)
  2008. #define LOGOFF_ABORT            ((ULONG) 0x00000008)
  2009. #define LOGOFF_QUIET            ((ULONG) 0x00000010)
  2010.  
  2011. #define LOGOFF_COMPLETE         ((ULONG) 0x00010000)
  2012. #define LOGOFF_INBOUND          ((ULONG) 0x00020000)
  2013. #define LOGOFF_OUTBOUND         ((ULONG) 0x00040000)
  2014. #define LOGOFF_OUTBOUND_QUEUE   ((ULONG) 0x00080000)
  2015.  
  2016. /* SetLockState() */
  2017.  
  2018. #define MSG_LOCKED              ((ULONG) 0x00000001)
  2019. #define MSG_UNLOCKED            ((ULONG) 0x00000000)
  2020.  
  2021. /* Flag bits for PR_VALID_FOLDER_MASK */
  2022.  
  2023. #define FOLDER_IPM_SUBTREE_VALID        ((ULONG) 0x00000001)
  2024. #define FOLDER_IPM_INBOX_VALID          ((ULONG) 0x00000002)
  2025. #define FOLDER_IPM_OUTBOX_VALID         ((ULONG) 0x00000004)
  2026. #define FOLDER_IPM_WASTEBASKET_VALID    ((ULONG) 0x00000008)
  2027. #define FOLDER_IPM_SENTMAIL_VALID       ((ULONG) 0x00000010)
  2028. #define FOLDER_VIEWS_VALID              ((ULONG) 0x00000020)
  2029. #define FOLDER_COMMON_VIEWS_VALID       ((ULONG) 0x00000040)
  2030. #define FOLDER_FINDER_VALID             ((ULONG) 0x00000080)
  2031.  
  2032. #define MAPI_IMSGSTORE_METHODS(IPURE)                                   \
  2033.     MAPIMETHOD(Advise)                                                  \
  2034.         (THIS_  ULONG                       cbEntryID,                  \
  2035.                 LPENTRYID                   lpEntryID,                  \
  2036.                 ULONG                       ulEventMask,                \
  2037.                 LPMAPIADVISESINK            lpAdviseSink,               \
  2038.                 ULONG FAR *                 lpulConnection) IPURE;      \
  2039.     MAPIMETHOD(Unadvise)                                                \
  2040.         (THIS_  ULONG                       ulConnection) IPURE;        \
  2041.     MAPIMETHOD(CompareEntryIDs)                                         \
  2042.         (THIS_  ULONG                       cbEntryID1,                 \
  2043.                 LPENTRYID                   lpEntryID1,                 \
  2044.                 ULONG                       cbEntryID2,                 \
  2045.                 LPENTRYID                   lpEntryID2,                 \
  2046.                 ULONG                       ulFlags,                    \
  2047.                 ULONG FAR *                 lpulResult) IPURE;          \
  2048.     MAPIMETHOD(OpenEntry)                                               \
  2049.         (THIS_  ULONG                       cbEntryID,                  \
  2050.                 LPENTRYID                   lpEntryID,                  \
  2051.                 LPCIID                      lpInterface,                \
  2052.                 ULONG                       ulFlags,                    \
  2053.                 ULONG FAR *                 lpulObjType,                \
  2054.                 LPUNKNOWN FAR *             lppUnk) IPURE;              \
  2055.     MAPIMETHOD(SetReceiveFolder)                                        \
  2056.         (THIS_  LPTSTR                      lpszMessageClass,           \
  2057.                 ULONG                       ulFlags,                    \
  2058.                 ULONG                       cbEntryID,                  \
  2059.                 LPENTRYID                   lpEntryID) IPURE;           \
  2060.     MAPIMETHOD(GetReceiveFolder)                                        \
  2061.         (THIS_  LPTSTR                      lpszMessageClass,           \
  2062.                 ULONG                       ulFlags,                    \
  2063.                 ULONG FAR *                 lpcbEntryID,                \
  2064.                 LPENTRYID FAR *             lppEntryID,                 \
  2065.                 LPTSTR FAR *                lppszExplicitClass) IPURE;  \
  2066.     MAPIMETHOD(GetReceiveFolderTable)                                   \
  2067.         (THIS_  ULONG                       ulFlags,                    \
  2068.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2069.     MAPIMETHOD(StoreLogoff)                                             \
  2070.         (THIS_  ULONG FAR *                 lpulFlags) IPURE;           \
  2071.     MAPIMETHOD(AbortSubmit)                                             \
  2072.         (THIS_  ULONG                       cbEntryID,                  \
  2073.                 LPENTRYID                   lpEntryID,                  \
  2074.                 ULONG                       ulFlags) IPURE;             \
  2075.     MAPIMETHOD(GetOutgoingQueue)                                        \
  2076.         (THIS_  ULONG                       ulFlags,                    \
  2077.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2078.     MAPIMETHOD(SetLockState)                                            \
  2079.         (THIS_  LPMESSAGE                   lpMessage,                  \
  2080.                 ULONG                       ulLockState) IPURE;         \
  2081.     MAPIMETHOD(FinishedMsg)                                             \
  2082.         (THIS_  ULONG                       ulFlags,                    \
  2083.                 ULONG                       cbEntryID,                  \
  2084.                 LPENTRYID                   lpEntryID) IPURE;           \
  2085.     MAPIMETHOD(NotifyNewMail)                                           \
  2086.         (THIS_  LPNOTIFICATION              lpNotification) IPURE;      \
  2087.  
  2088. #undef       INTERFACE
  2089. #define      INTERFACE  IMsgStore
  2090. DECLARE_MAPI_INTERFACE_(IMsgStore, IMAPIProp)
  2091. {
  2092.     BEGIN_INTERFACE
  2093.     MAPI_IUNKNOWN_METHODS(PURE)
  2094.     MAPI_IMAPIPROP_METHODS(PURE)
  2095.     MAPI_IMSGSTORE_METHODS(PURE)
  2096. };
  2097.  
  2098. /* IMessage Interface ------------------------------------------------------ */
  2099.  
  2100. /* SubmitMessage */
  2101.  
  2102. #define FORCE_SUBMIT                ((ULONG) 0x00000001)
  2103.  
  2104. /* Flags defined in PR_MESSAGE_FLAGS */
  2105.  
  2106. #define MSGFLAG_READ            ((ULONG) 0x00000001)
  2107. #define MSGFLAG_UNMODIFIED      ((ULONG) 0x00000002)
  2108. #define MSGFLAG_SUBMIT          ((ULONG) 0x00000004)
  2109. #define MSGFLAG_UNSENT          ((ULONG) 0x00000008)
  2110. #define MSGFLAG_HASATTACH       ((ULONG) 0x00000010)
  2111. #define MSGFLAG_FROMME          ((ULONG) 0x00000020)
  2112. #define MSGFLAG_ASSOCIATED      ((ULONG) 0x00000040)
  2113. #define MSGFLAG_RESEND          ((ULONG) 0x00000080)
  2114. #define MSGFLAG_RN_PENDING      ((ULONG) 0x00000100)
  2115. #define MSGFLAG_NRN_PENDING     ((ULONG) 0x00000200)
  2116.  
  2117. /* Flags defined in PR_SUBMIT_FLAGS */
  2118.  
  2119. #define SUBMITFLAG_LOCKED       ((ULONG) 0x00000001)
  2120. #define SUBMITFLAG_PREPROCESS   ((ULONG) 0x00000002)
  2121.  
  2122. /* GetAttachmentTable() */
  2123. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  2124.  
  2125. /* GetRecipientTable() */
  2126. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  2127.  
  2128. /* ModifyRecipients */
  2129.  
  2130. /* ((ULONG) 0x00000001 is not a valid flag on ModifyRecipients. */
  2131. #define MODRECIP_ADD            ((ULONG) 0x00000002)
  2132. #define MODRECIP_MODIFY         ((ULONG) 0x00000004)
  2133. #define MODRECIP_REMOVE         ((ULONG) 0x00000008)
  2134.  
  2135. /* SetReadFlag */
  2136.  
  2137. #define SUPPRESS_RECEIPT        ((ULONG) 0x00000001)
  2138. #define CLEAR_READ_FLAG         ((ULONG) 0x00000004)
  2139. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  2140. #define GENERATE_RECEIPT_ONLY   ((ULONG) 0x00000010)
  2141. #define CLEAR_RN_PENDING        ((ULONG) 0x00000020)
  2142. #define CLEAR_NRN_PENDING       ((ULONG) 0x00000040)
  2143.  
  2144. /* DeleteAttach */
  2145.  
  2146. #define ATTACH_DIALOG           ((ULONG) 0x00000001)
  2147.  
  2148. /* PR_SECURITY values */
  2149. #define SECURITY_SIGNED         ((ULONG) 0x00000001)
  2150. #define SECURITY_ENCRYPTED      ((ULONG) 0x00000002)
  2151.  
  2152. /* PR_PRIORITY values */
  2153. #define PRIO_URGENT             ((long)  1)
  2154. #define PRIO_NORMAL             ((long)  0)
  2155. #define PRIO_NONURGENT          ((long) -1)
  2156.  
  2157. /* PR_SENSITIVITY values */
  2158. #define SENSITIVITY_NONE                    ((ULONG) 0x00000000)
  2159. #define SENSITIVITY_PERSONAL                ((ULONG) 0x00000001)
  2160. #define SENSITIVITY_PRIVATE                 ((ULONG) 0x00000002)
  2161. #define SENSITIVITY_COMPANY_CONFIDENTIAL    ((ULONG) 0x00000003)
  2162.  
  2163. /* PR_IMPORTANCE values */
  2164. #define IMPORTANCE_LOW          ((long) 0)
  2165. #define IMPORTANCE_NORMAL       ((long) 1)
  2166. #define IMPORTANCE_HIGH         ((long) 2)
  2167.  
  2168. #define MAPI_IMESSAGE_METHODS(IPURE)                                    \
  2169.     MAPIMETHOD(GetAttachmentTable)                                      \
  2170.         (THIS_  ULONG                       ulFlags,                    \
  2171.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2172.     MAPIMETHOD(OpenAttach)                                              \
  2173.         (THIS_  ULONG                       ulAttachmentNum,            \
  2174.                 LPCIID                      lpInterface,                \
  2175.                 ULONG                       ulFlags,                    \
  2176.                 LPATTACH FAR *              lppAttach) IPURE;           \
  2177.     MAPIMETHOD(CreateAttach)                                            \
  2178.         (THIS_  LPCIID                      lpInterface,                \
  2179.                 ULONG                       ulFlags,                    \
  2180.                 ULONG FAR *                 lpulAttachmentNum,          \
  2181.                 LPATTACH FAR *              lppAttach) IPURE;           \
  2182.     MAPIMETHOD(DeleteAttach)                                            \
  2183.         (THIS_  ULONG                       ulAttachmentNum,            \
  2184.                 ULONG                       ulUIParam,                  \
  2185.                 LPMAPIPROGRESS              lpProgress,                 \
  2186.                 ULONG                       ulFlags) IPURE;             \
  2187.     MAPIMETHOD(GetRecipientTable)                                       \
  2188.         (THIS_  ULONG                       ulFlags,                    \
  2189.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2190.     MAPIMETHOD(ModifyRecipients)                                        \
  2191.         (THIS_  ULONG                       ulFlags,                    \
  2192.                 LPADRLIST                   lpMods) IPURE;              \
  2193.     MAPIMETHOD(SubmitMessage)                                           \
  2194.         (THIS_  ULONG                       ulFlags) IPURE;             \
  2195.     MAPIMETHOD(SetReadFlag)                                             \
  2196.         (THIS_  ULONG                       ulFlags) IPURE;             \
  2197.  
  2198. #undef       INTERFACE
  2199. #define      INTERFACE  IMessage
  2200. DECLARE_MAPI_INTERFACE_(IMessage, IMAPIProp)
  2201. {
  2202.     BEGIN_INTERFACE
  2203.     MAPI_IUNKNOWN_METHODS(PURE)
  2204.     MAPI_IMAPIPROP_METHODS(PURE)
  2205.     MAPI_IMESSAGE_METHODS(PURE)
  2206. };
  2207.  
  2208. /* IAttach Interface ------------------------------------------------------- */
  2209.  
  2210. /* IAttach attachment methods: PR_ATTACH_METHOD values */
  2211.  
  2212. #define NO_ATTACHMENT           ((ULONG) 0x00000000)
  2213. #define ATTACH_BY_VALUE         ((ULONG) 0x00000001)
  2214. #define ATTACH_BY_REFERENCE     ((ULONG) 0x00000002)
  2215. #define ATTACH_BY_REF_RESOLVE   ((ULONG) 0x00000003)
  2216. #define ATTACH_BY_REF_ONLY      ((ULONG) 0x00000004)
  2217. #define ATTACH_EMBEDDED_MSG     ((ULONG) 0x00000005)
  2218. #define ATTACH_OLE              ((ULONG) 0x00000006)
  2219.  
  2220. #define MAPI_IATTACH_METHODS(IPURE)
  2221.  
  2222. #undef       INTERFACE
  2223. #define      INTERFACE  IAttach
  2224. DECLARE_MAPI_INTERFACE_(IAttach, IMAPIProp)
  2225. {
  2226.     BEGIN_INTERFACE
  2227.     MAPI_IUNKNOWN_METHODS(PURE)
  2228.     MAPI_IMAPIPROP_METHODS(PURE)
  2229.     MAPI_IATTACH_METHODS(PURE)
  2230. };
  2231.  
  2232. /* --------------------------------- */
  2233. /* Address Book interface definition */
  2234.  
  2235. /* ADRPARM ulFlags - top 4 bits used for versioning */
  2236.  
  2237. #define GET_ADRPARM_VERSION(ulFlags)  (((ULONG)ulFlags) & 0xF0000000)
  2238. #define SET_ADRPARM_VERSION(ulFlags, ulVersion)  (((ULONG)ulVersion) | (((ULONG)ulFlags) & 0x0FFFFFFF))
  2239.  
  2240. /*  Current versions of ADRPARM  */
  2241. #define ADRPARM_HELP_CTX        ((ULONG) 0x00000000)
  2242.  
  2243.  
  2244. /*  ulFlags   - bit fields */
  2245. #define DIALOG_MODAL            ((ULONG) 0x00000001)
  2246. #define DIALOG_SDI              ((ULONG) 0x00000002)
  2247. #define DIALOG_OPTIONS          ((ULONG) 0x00000004)
  2248. #define ADDRESS_ONE             ((ULONG) 0x00000008)
  2249. #define AB_SELECTONLY           ((ULONG) 0x00000010)
  2250. #define AB_RESOLVE              ((ULONG) 0x00000020)
  2251.  
  2252. /* --------------------------------- */
  2253. /*  PR_DISPLAY_TYPEs                 */
  2254. /*
  2255.  *  These standard display types are
  2256.  *  by default handled by MAPI.
  2257.  *  They have default icons associated
  2258.  *  with them.
  2259.  */
  2260.  
  2261. /*  For address book contents tables */
  2262. #define DT_MAILUSER         ((ULONG) 0x00000000)
  2263. #define DT_DISTLIST         ((ULONG) 0x00000001)
  2264. #define DT_FORUM            ((ULONG) 0x00000002)
  2265. #define DT_AGENT            ((ULONG) 0x00000003)
  2266. #define DT_ORGANIZATION     ((ULONG) 0x00000004)
  2267. #define DT_PRIVATE_DISTLIST ((ULONG) 0x00000005)
  2268. #define DT_REMOTE_MAILUSER  ((ULONG) 0x00000006)
  2269.  
  2270. /*  For address book hierarchy tables */
  2271. #define DT_MODIFIABLE       ((ULONG) 0x00010000)
  2272. #define DT_GLOBAL           ((ULONG) 0x00020000)
  2273. #define DT_LOCAL            ((ULONG) 0x00030000)
  2274. #define DT_WAN              ((ULONG) 0x00040000)
  2275. #define DT_NOT_SPECIFIC     ((ULONG) 0x00050000)
  2276.  
  2277. /*  For folder hierarchy tables */
  2278. #define DT_FOLDER           ((ULONG) 0x01000000)
  2279. #define DT_FOLDER_LINK      ((ULONG) 0x02000000)
  2280. #define DT_FOLDER_SPECIAL   ((ULONG) 0x04000000)
  2281.  
  2282. /*  Accelerator callback for DIALOG_SDI form of AB UI */
  2283. typedef BOOL (STDMETHODCALLTYPE ACCELERATEABSDI)(ULONG ulUIParam,
  2284.                                                 LPVOID lpvmsg);
  2285. typedef ACCELERATEABSDI FAR * LPFNABSDI;
  2286.  
  2287. /*  Callback to application telling it that the DIALOG_SDI form of the */
  2288. /*  AB UI has been dismissed.  This is so that the above LPFNABSDI     */
  2289. /*  function doesn't keep being called.                                */
  2290. typedef void (STDMETHODCALLTYPE DISMISSMODELESS)(ULONG ulUIParam,
  2291.                                                 LPVOID lpvContext);
  2292. typedef DISMISSMODELESS FAR * LPFNDISMISS;
  2293.  
  2294. /*
  2295.  * Prototype for the client function hooked to an optional button on
  2296.  * the address book dialog
  2297.  */
  2298.  
  2299. typedef SCODE (STDMETHODCALLTYPE FAR * LPFNBUTTON)(
  2300.     ULONG               ulUIParam,
  2301.     LPVOID              lpvContext,
  2302.     ULONG               cbEntryID,
  2303.     LPENTRYID           lpSelection,
  2304.     ULONG               ulFlags
  2305. );
  2306.  
  2307.  
  2308. /* Parameters for the address book dialog */
  2309. typedef struct _ADRPARM
  2310. {
  2311.     ULONG           cbABContEntryID;
  2312.     LPENTRYID       lpABContEntryID;
  2313.     ULONG           ulFlags;
  2314.  
  2315.     LPVOID          lpReserved;
  2316.     ULONG           ulHelpContext;
  2317.     LPTSTR          lpszHelpFileName;
  2318.  
  2319.     LPFNABSDI       lpfnABSDI;
  2320.     LPFNDISMISS     lpfnDismiss;
  2321.     LPVOID          lpvDismissContext;
  2322.     LPTSTR          lpszCaption;
  2323.     LPTSTR          lpszNewEntryTitle;
  2324.     LPTSTR          lpszDestWellsTitle;
  2325.     ULONG           cDestFields;
  2326.     ULONG           nDestFieldFocus;
  2327.     LPTSTR FAR *    lppszDestTitles;
  2328.     ULONG FAR *     lpulDestComps;
  2329.     LPSRestriction  lpContRestriction;
  2330.     LPSRestriction  lpHierRestriction;
  2331. } ADRPARM, FAR * LPADRPARM;
  2332.  
  2333.  
  2334. /* ------------ */
  2335. /* Random flags */
  2336.  
  2337. /* Flag for deferred error */
  2338. #define MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008)
  2339.  
  2340. /* Flag for creating and using Folder Associated Information Messages */
  2341. #define MAPI_ASSOCIATED         ((ULONG) 0x00000040)
  2342.  
  2343. /* Flags for OpenMessageStore() */
  2344.  
  2345. #define MDB_NO_DIALOG           ((ULONG) 0x00000001)
  2346. #define MDB_WRITE               ((ULONG) 0x00000004)
  2347. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) above */
  2348. /****** MAPI_BEST_ACCESS        ((ULONG) 0x00000010) above */
  2349. #define MDB_TEMPORARY           ((ULONG) 0x00000020)
  2350. #define MDB_NO_MAIL             ((ULONG) 0x00000080)
  2351.  
  2352. /* Flags for OpenAddressBook */
  2353.  
  2354. #define AB_NO_DIALOG            ((ULONG) 0x00000001)
  2355.  
  2356. /* IMAPIControl Interface -------------------------------------------------- */
  2357.  
  2358. /* Interface used in controls (particularly the button) defined by */
  2359. /* Display Tables. */
  2360.  
  2361. /*  Flags for GetState */
  2362.  
  2363. #define  MAPI_ENABLED       ((ULONG) 0x00000000)
  2364. #define  MAPI_DISABLED      ((ULONG) 0x00000001)
  2365.  
  2366. #define MAPI_IMAPICONTROL_METHODS(IPURE)                                \
  2367.     MAPIMETHOD(GetLastError)                                            \
  2368.         (THIS_  HRESULT                     hResult,                    \
  2369.                 ULONG                       ulFlags,                    \
  2370.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  2371.     MAPIMETHOD(Activate)                                                \
  2372.         (THIS_  ULONG                       ulFlags,                    \
  2373.                 ULONG                       ulUIParam) IPURE;           \
  2374.     MAPIMETHOD(GetState)                                                \
  2375.         (THIS_  ULONG                       ulFlags,                    \
  2376.                 ULONG FAR *                 lpulState) IPURE;           \
  2377.  
  2378. #undef       INTERFACE
  2379. #define      INTERFACE  IMAPIControl
  2380. DECLARE_MAPI_INTERFACE_(IMAPIControl, IUnknown)
  2381. {
  2382.     BEGIN_INTERFACE
  2383.     MAPI_IUNKNOWN_METHODS(PURE)
  2384.     MAPI_IMAPICONTROL_METHODS(PURE)
  2385. };
  2386.  
  2387. DECLARE_MAPI_INTERFACE_PTR(IMAPIControl, LPMAPICONTROL);
  2388.  
  2389. /* Display Tables ---------------------------------------------------------- */
  2390.  
  2391. /* Flags used in display tables - that is, PR_CONTROL_FLAGS */
  2392.  
  2393. #define DT_MULTILINE        ((ULONG) 0x00000001)
  2394. #define DT_EDITABLE         ((ULONG) 0x00000002)
  2395. #define DT_REQUIRED         ((ULONG) 0x00000004)
  2396. #define DT_SET_IMMEDIATE    ((ULONG) 0x00000008)
  2397. #define DT_PASSWORD_EDIT    ((ULONG) 0x00000010)
  2398. #define DT_ACCEPT_DBCS      ((ULONG) 0x00000020)
  2399. #define DT_SET_SELECTION    ((ULONG) 0x00000040)
  2400.  
  2401. /* Display Table structures */
  2402.  
  2403. #define DTCT_LABEL          ((ULONG) 0x00000000)
  2404. #define DTCT_EDIT           ((ULONG) 0x00000001)
  2405. #define DTCT_LBX            ((ULONG) 0x00000002)
  2406. #define DTCT_COMBOBOX       ((ULONG) 0x00000003)
  2407. #define DTCT_DDLBX          ((ULONG) 0x00000004)
  2408. #define DTCT_CHECKBOX       ((ULONG) 0x00000005)
  2409. #define DTCT_GROUPBOX       ((ULONG) 0x00000006)
  2410. #define DTCT_BUTTON         ((ULONG) 0x00000007)
  2411. #define DTCT_PAGE           ((ULONG) 0x00000008)
  2412. #define DTCT_RADIOBUTTON    ((ULONG) 0x00000009)
  2413. #define DTCT_MVLISTBOX      ((ULONG) 0x0000000B)
  2414. #define DTCT_MVDDLBX        ((ULONG) 0x0000000C)
  2415.  
  2416. /* Labels */
  2417. /* Valid ulFlags:
  2418.  *   MAPI_UNICODE
  2419.  */
  2420. typedef struct _DTBLLABEL
  2421. {
  2422.     ULONG ulbLpszLabelName;
  2423.     ULONG ulFlags;
  2424. } DTBLLABEL, FAR * LPDTBLLABEL;
  2425. #define SizedDtblLabel(n,u) \
  2426. struct _DTBLLABEL_ ## u \
  2427. { \
  2428.     DTBLLABEL   dtbllabel; \
  2429.     TCHAR       lpszLabelName[n]; \
  2430. } u
  2431.  
  2432.  
  2433. /*  Simple Text Edits  */
  2434. /* Valid ulFlags:
  2435.  *   MAPI_UNICODE
  2436.  */
  2437. typedef struct _DTBLEDIT
  2438. {
  2439.     ULONG ulbLpszCharsAllowed;
  2440.     ULONG ulFlags;
  2441.     ULONG ulNumCharsAllowed;
  2442.     ULONG ulPropTag;
  2443. } DTBLEDIT, FAR * LPDTBLEDIT;
  2444. #define SizedDtblEdit(n,u) \
  2445. struct _DTBLEDIT_ ## u \
  2446. { \
  2447.     DTBLEDIT    dtbledit; \
  2448.     TCHAR       lpszCharsAllowed[n]; \
  2449. } u
  2450.  
  2451. /*  List Box  */
  2452. /* Valid ulFlags:
  2453.  */
  2454. #define MAPI_NO_HBAR        ((ULONG) 0x00000001)
  2455. #define MAPI_NO_VBAR        ((ULONG) 0x00000002)
  2456.  
  2457. typedef struct _DTBLLBX
  2458. {
  2459.     ULONG ulFlags;
  2460.     ULONG ulPRSetProperty;
  2461.     ULONG ulPRTableName;
  2462. } DTBLLBX, FAR * LPDTBLLBX;
  2463.  
  2464.  
  2465. /*  Combo Box   */
  2466. /* Valid ulFlags:
  2467.  *   MAPI_UNICODE
  2468.  */
  2469. typedef struct _DTBLCOMBOBOX
  2470. {
  2471.     ULONG ulbLpszCharsAllowed;
  2472.     ULONG ulFlags;
  2473.     ULONG ulNumCharsAllowed;
  2474.     ULONG ulPRPropertyName;
  2475.     ULONG ulPRTableName;
  2476. } DTBLCOMBOBOX, FAR * LPDTBLCOMBOBOX;
  2477. #define SizedDtblComboBox(n,u) \
  2478. struct _DTBLCOMBOBOX_ ## u \
  2479. { \
  2480.     DTBLCOMBOBOX    dtblcombobox; \
  2481.     TCHAR           lpszCharsAllowed[n]; \
  2482. } u
  2483.  
  2484.  
  2485. /*  Drop Down   */
  2486. /* Valid ulFlags:
  2487.  *   none
  2488.  */
  2489. typedef struct _DTBLDDLBX
  2490. {
  2491.     ULONG ulFlags;
  2492.     ULONG ulPRDisplayProperty;
  2493.     ULONG ulPRSetProperty;
  2494.     ULONG ulPRTableName;
  2495. } DTBLDDLBX, FAR * LPDTBLDDLBX;
  2496.  
  2497.  
  2498. /*  Check Box   */
  2499. /* Valid ulFlags:
  2500.  *   MAPI_UNICODE
  2501.  */
  2502. typedef struct _DTBLCHECKBOX
  2503. {
  2504.     ULONG ulbLpszLabel;
  2505.     ULONG ulFlags;
  2506.     ULONG ulPRPropertyName;
  2507. } DTBLCHECKBOX, FAR * LPDTBLCHECKBOX;
  2508. #define SizedDtblCheckBox(n,u) \
  2509. struct _DTBLCHECKBOX_ ## u \
  2510. { \
  2511.     DTBLCHECKBOX    dtblcheckbox; \
  2512.     TCHAR       lpszLabel[n]; \
  2513. } u
  2514.  
  2515.  
  2516.  
  2517. /*  Group Box   */
  2518. /* Valid ulFlags:
  2519.  *   MAPI_UNICODE
  2520.  */
  2521. typedef struct _DTBLGROUPBOX
  2522. {
  2523.     ULONG ulbLpszLabel;
  2524.     ULONG ulFlags;
  2525. } DTBLGROUPBOX, FAR * LPDTBLGROUPBOX;
  2526. #define SizedDtblGroupBox(n,u) \
  2527. struct _DTBLGROUPBOX_ ## u \
  2528. { \
  2529.     DTBLGROUPBOX    dtblgroupbox; \
  2530.     TCHAR           lpszLabel[n]; \
  2531. } u
  2532.  
  2533. /*  Button control   */
  2534. /* Valid ulFlags:
  2535.  *   MAPI_UNICODE
  2536.  */
  2537. typedef struct _DTBLBUTTON
  2538. {
  2539.     ULONG ulbLpszLabel;
  2540.     ULONG ulFlags;
  2541.     ULONG ulPRControl;
  2542. } DTBLBUTTON, FAR * LPDTBLBUTTON;
  2543. #define SizedDtblButton(n,u) \
  2544. struct _DTBLBUTTON_ ## u \
  2545. { \
  2546.     DTBLBUTTON  dtblbutton; \
  2547.     TCHAR       lpszLabel[n]; \
  2548. } u
  2549.  
  2550. /*  Pages   */
  2551. /* Valid ulFlags:
  2552.  *   MAPI_UNICODE
  2553.  */
  2554. typedef struct _DTBLPAGE
  2555. {
  2556.     ULONG ulbLpszLabel;
  2557.     ULONG ulFlags;
  2558.     ULONG ulbLpszComponent;
  2559.     ULONG ulContext;
  2560. } DTBLPAGE, FAR * LPDTBLPAGE;
  2561. #define SizedDtblPage(n,n1,u) \
  2562. struct _DTBLPAGE_ ## u \
  2563. { \
  2564.     DTBLPAGE    dtblpage; \
  2565.     TCHAR       lpszLabel[n]; \
  2566.     TCHAR       lpszComponent[n1]; \
  2567. } u
  2568.  
  2569. /*  Radio button   */
  2570. /* Valid ulFlags:
  2571.  *   MAPI_UNICODE
  2572.  */
  2573. typedef struct _DTBLRADIOBUTTON
  2574. {
  2575.     ULONG ulbLpszLabel;
  2576.     ULONG ulFlags;
  2577.     ULONG ulcButtons;
  2578.     ULONG ulPropTag;
  2579.     long lReturnValue;
  2580. } DTBLRADIOBUTTON, FAR * LPDTBLRADIOBUTTON;
  2581. #define SizedDtblRadioButton(n,u) \
  2582. struct _DTBLRADIOBUTTON_ ## u \
  2583. { \
  2584.     DTBLRADIOBUTTON dtblradiobutton; \
  2585.     TCHAR           lpszLabel[n]; \
  2586. } u
  2587.  
  2588.  
  2589. /*  MultiValued listbox */
  2590. /* Valid ulFlags:
  2591.  *   none
  2592.  */
  2593. typedef struct _DTBLMVLISTBOX
  2594. {
  2595.     ULONG ulFlags;
  2596.     ULONG ulMVPropTag;
  2597. } DTBLMVLISTBOX, FAR * LPDTBLMVLISTBOX;
  2598.  
  2599.  
  2600. /*  MultiValued dropdown */
  2601. /* Valid ulFlags:
  2602.  *   none
  2603.  */
  2604. typedef struct _DTBLMVDDLBX
  2605. {
  2606.     ULONG ulFlags;
  2607.     ULONG ulMVPropTag;
  2608. } DTBLMVDDLBX, FAR * LPDTBLMVDDLBX;
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614. /* IProviderAdmin Interface ---------------------------------------------- */
  2615.  
  2616. /* Flags for ConfigureMsgService */
  2617.  
  2618. #define UI_SERVICE                  0x00000002
  2619. #define SERVICE_UI_ALWAYS           0x00000002      /* Duplicate UI_SERVICE for consistency and compatibility */
  2620. #define SERVICE_UI_ALLOWED          0x00000010
  2621. #define UI_CURRENT_PROVIDER_FIRST   0x00000004
  2622. /* MSG_SERVICE_UI_READ_ONLY         0x00000008 - in MAPISPI.H */
  2623.  
  2624. /* GetProviderTable() */
  2625. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  2626.  
  2627. /* Values for PR_RESOURCE_FLAGS in message service table */
  2628.  
  2629. #define MAPI_IPROVIDERADMIN_METHODS(IPURE)                              \
  2630.     MAPIMETHOD(GetLastError)                                            \
  2631.         (THIS_  HRESULT                     hResult,                    \
  2632.                 ULONG                       ulFlags,                    \
  2633.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  2634.     MAPIMETHOD(GetProviderTable)                                        \
  2635.         (THIS_  ULONG                       ulFlags,                    \
  2636.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2637.     MAPIMETHOD(CreateProvider)                                          \
  2638.         (THIS_  LPTSTR                      lpszProvider,               \
  2639.                 ULONG                       cValues,                    \
  2640.                 LPSPropValue                lpProps,                    \
  2641.                 ULONG                       ulUIParam,                  \
  2642.                 ULONG                       ulFlags,                    \
  2643.                 MAPIUID FAR *               lpUID) IPURE;               \
  2644.     MAPIMETHOD(DeleteProvider)                                          \
  2645.         (THIS_  LPMAPIUID                   lpUID) IPURE;               \
  2646.     MAPIMETHOD(OpenProfileSection)                                      \
  2647.         (THIS_  LPMAPIUID                   lpUID,                      \
  2648.                 LPCIID                      lpInterface,                \
  2649.                 ULONG                       ulFlags,                    \
  2650.                 LPPROFSECT FAR *            lppProfSect) IPURE;         \
  2651.  
  2652.  
  2653. #undef       INTERFACE
  2654. #define      INTERFACE  IProviderAdmin
  2655. DECLARE_MAPI_INTERFACE_(IProviderAdmin, IUnknown)
  2656. {
  2657.     BEGIN_INTERFACE
  2658.     MAPI_IUNKNOWN_METHODS(PURE)
  2659.     MAPI_IPROVIDERADMIN_METHODS(PURE)
  2660. };
  2661.  
  2662.  
  2663.  
  2664. #ifdef  __cplusplus
  2665. }       /*  extern "C" */
  2666. #endif
  2667.  
  2668. #ifdef __BORLANDC__
  2669. #  include <poppack.h>
  2670. #endif
  2671.  
  2672. #pragma option pop
  2673. #endif /* MAPIDEFS_H */
  2674.